kexec: ensure kexec_status() return bit value of 0 or 1
authorEric DeVolder <eric.devolder@oracle.com>
Thu, 19 Jan 2017 17:10:53 +0000 (11:10 -0600)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Jan 2017 13:41:28 +0000 (13:41 +0000)
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>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/kexec.c

index aa808cb2f2c4256dc99041d427c5a26371e4a855..940fc7ec943ae0b185d6431bdbbe383e8444401a 100644 (file)
@@ -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);
 }
 
 static int do_kexec_op_internal(unsigned long op,