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 2/2] kexec: ensure kexec_status() always returns 0 or 1
Date: Wed, 18 Jan 2017 15:47:28 -0600	[thread overview]
Message-ID: <1484776048-8995-3-git-send-email-eric.devolder@oracle.com> (raw)
In-Reply-To: <1484776048-8995-1-git-send-email-eric.devolder@oracle.com>

The use of test_bit() can also return EPERM, so the
return value from test_bit() must be checked to
ensure that kexec_status() always returns 0, 1 or
-1, per the public header description.

Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
 xen/common/kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index aa808cb..40b76d5 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -1182,7 +1182,7 @@ 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);
+    return (test_bit(bit, &kexec_flags) == 1);
 }
 
 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

  parent reply	other threads:[~2017-01-18 21:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 21:47 [PATCH] kexec: followup to STATUS patch v3 already in staging Eric DeVolder
2017-01-18 21:47 ` [PATCH 1/2] Put back blank line for readability purposes Eric DeVolder
2017-01-18 22:17   ` Daniel Kiper
2017-01-18 21:47 ` Eric DeVolder [this message]
2017-01-18 22:17   ` [PATCH 2/2] kexec: ensure kexec_status() always returns 0 or 1 Daniel Kiper
2017-01-19  8:07   ` Jan Beulich
2017-01-19 11:27     ` Daniel Kiper
2017-01-18 22:20 ` [PATCH] kexec: followup to STATUS patch v3 already in staging Daniel Kiper

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=1484776048-8995-3-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).