xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <George.Dunlap@citrix.com>
To: Ian Jackson <Ian.Jackson@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH v2 05/10] libxl: Do root checks once in libxl__domain_get_device_model_uid
Date: Thu, 20 Dec 2018 22:12:28 +0000	[thread overview]
Message-ID: <9E1B3F6A-8BD6-4C16-9422-1A02B18A732C@citrix.com> (raw)
In-Reply-To: <23577.3378.432130.113064@mariner.uk.xensource.com>


> On Dec 18, 2018, at 3:07 PM, Ian Jackson <ian.jackson@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-12-20 22:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 15:02 [PATCH v2 01/10] libxl: Move dm user determination logic into a helper function George Dunlap
2018-12-06 15:02 ` [PATCH v2 02/10] libxl: Get rid of support for QEMU_USER_BASE (xen-qemuuser-domidNN) George Dunlap
2018-12-06 15:02 ` [PATCH v2 03/10] libxl: Clean up userlookup_helper_getpw* helper George Dunlap
2018-12-12 15:26   ` Ian Jackson
2018-12-12 17:39     ` George Dunlap
2018-12-06 15:02 ` [PATCH v2 04/10] dm_depriv: Describe expected usage of device_model_user parameter George Dunlap
2018-12-06 15:02 ` [PATCH v2 05/10] libxl: Do root checks once in libxl__domain_get_device_model_uid George Dunlap
2018-12-12 15:45   ` Ian Jackson
2018-12-12 18:20     ` George Dunlap
2018-12-18 15:07       ` Ian Jackson
2018-12-20 22:12         ` George Dunlap [this message]
2018-12-06 15:02 ` [PATCH v2 06/10] libxl: Move qmp cleanup into devicemodel destroy function George Dunlap
2018-12-06 15:02 ` [PATCH v2 07/10] libxl: Make killing of device model asynchronous George Dunlap
2018-12-12 15:46   ` Ian Jackson
2018-12-06 15:02 ` [PATCH v2 08/10] libxl: Kill QEMU by uid when possible George Dunlap
2018-12-12 16:17   ` Ian Jackson
2018-12-17 18:09     ` George Dunlap
2018-12-18 11:18       ` Ian Jackson
2018-12-06 15:02 ` [PATCH v2 09/10] libxl: Kill QEMU with "reaper" ruid George Dunlap
2018-12-12 16:30   ` Ian Jackson
2018-12-06 15:02 ` [PATCH v2 10/10] dm_depriv: Mark `UID cleanup` as completed George Dunlap
2018-12-12 16:31   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9E1B3F6A-8BD6-4C16-9422-1A02B18A732C@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).