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

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>
---
 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 */
+    return !!test_bit(bit, &kexec_flags);
 }
 
 static int do_kexec_op_internal(unsigned long op,
-- 
2.7.4


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

  reply	other threads:[~2017-01-19 17:10 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 ` Eric DeVolder [this message]
2017-01-19 18:05   ` [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1 Daniel Kiper
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=1484845853-11266-2-git-send-email-eric.devolder@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=daniel.kiper@oracle.com \
    --cc=elena.ufimtseva@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).