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

[Xen-devel] [PATCH] kexec: ensure kexec_status() always returns 0 or 1



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.
---
 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@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®.