[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 05/10] libxl: Do root checks once in libxl__domain_get_device_model_uid


  • To: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxx>
  • Date: Thu, 20 Dec 2018 22:12:28 +0000
  • Accept-language: en-GB, en-US
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>
  • Delivery-date: Thu, 20 Dec 2018 22:12:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHUjXTGk3J6iZXnEU6AxflxyWA/o6V7N6WAgAArZQCACTgTAIADm2UA
  • Thread-topic: [PATCH v2 05/10] libxl: Do root checks once in libxl__domain_get_device_model_uid

> On Dec 18, 2018, at 3:07 PM, Ian Jackson <ian.jackson@xxxxxxxxxx> wrote:
> 
>> If we switch the earlier `return 0` in the !dm_restrict conditional to a 
>> “goto out”, then this would turn into:
> 
> I think setting intended_uid==0 when user==0 is a hostage to fortune.
> Why not set it to (uid_t)-1 ?
> 
> Then you write:
> 
>  if (!rc) {
>     if (intended_uid == 0) {
>         complain
>         rc = ERROR_INVAL;
>     }
>  }
>  if (!rc) {
>     save user and intended_uid
>  }
> 
>> If you have a favorite color it might be better just to tell me. :-)
> 
> Do you see why I prefer the above ?

Not at all I’m afraid.  Especially now that we have two separate “if (!rc)” 
checks,  I think having an extra label to jump to when we know the check needs 
to be done makes the code both more aesthetically pleasing and easier to 
understand.  But it’s your house, if you want it orange and purple, that’s what 
color I’ll paint it. :-)

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.