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

[Xen-devel] [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1



When checking kexec_flags bit corresponding to the
requested image, ensure that 0 or 1 is returned.

Signed-off-by: Eric DeVolder <eric.devolder@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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