xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: Eric DeVolder <eric.devolder@oracle.com>
Cc: elena.ufimtseva@oracle.com, wei.liu2@citrix.com,
	konrad.wilk@oracle.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1
Date: Thu, 19 Jan 2017 19:05:20 +0100	[thread overview]
Message-ID: <20170119180520.GD23864@olila.local.net-space.pl> (raw)
In-Reply-To: <1484845853-11266-2-git-send-email-eric.devolder@oracle.com>

On Thu, Jan 19, 2017 at 11:10:53AM -0600, Eric DeVolder wrote:
> When checking kexec_flags bit corresponding to the
> requested image, ensure that 0 or 1 is returned.
>
> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>

In general Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> but...

> ---
>  xen/common/kexec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/kexec.c b/xen/common/kexec.c
> index aa808cb..3da27bf 100644
> --- a/xen/common/kexec.c
> +++ b/xen/common/kexec.c
> @@ -1182,7 +1182,8 @@ static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) uarg)
>      if ( kexec_load_get_bits(status.type, &base, &bit) )
>          return -EINVAL;
>
> -    return test_bit(bit, &kexec_flags);
> +    /* Ensure return bit value of 0 or 1 */

This is not needed here. "!!" is used very often and it is not an unusual stuff.
So, it does not need any comment. However, I can agree that at first sight
it looks strange.

> +    return !!test_bit(bit, &kexec_flags);

Daniel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-01-19 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 17:10 [PATCH 0/1] Followup corrections for kexec_status() Eric DeVolder
2017-01-19 17:10 ` [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1 Eric DeVolder
2017-01-19 18:05   ` Daniel Kiper [this message]
2017-01-20  8:32   ` Jan Beulich
2017-01-20 15:01   ` Andrew Cooper

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=20170119180520.GD23864@olila.local.net-space.pl \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=eric.devolder@oracle.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).