Skip to contentSkip to conversation

Followup corrections to kexec STATUS patch v3

PATCH New Eric DeVolder 2 participants 4 messages Jan 18, 2017

lore
Share & tools
lore
#0 lore raw

This contains the two corrections pointed out by Jan Beulich for the kexec STATUS call just introduced.

Note: In kexec_status(), 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.

Note: My handling of the test_bit() scenario is to explicitly check for return value of 1, so any value other than 1 causes kexec_status to return 0.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw

PATCH 1/1 Put back blank line for readability purposes.

This blank line was accidentally removed during
the insertion of the kexec_status() declarations.

---
 xen/include/public/kexec.h | 1 +
 1 file changed, 1 insertion(+)
xen/include/public/kexec.h +1 -0
index c200e8c..74ea981 100644
@@ -240,6 +240,7 @@ typedef struct xen_kexec_status {
     uint8_t type;
 } xen_kexec_status_t;
 DEFINE_XEN_GUEST_HANDLE(xen_kexec_status_t);
+
 #else /* __XEN_INTERFACE_VERSION__ < 0x00040400 */
 
 #define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH 1/1 kexec: ensure kexec_status() always returns 0 or 1

In reply to Eric DeVolder

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(-)
xen/common/kexec.c +1 -1
index aa808cb..40b76d5 100644
@@ -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,
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to Eric DeVolder
Quoted 11 lines · Eric DeVolder

This contains the two corrections pointed out by Jan Beulich for the kexec STATUS call just introduced.

Note: In kexec_status(), 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.

Note: My handling of the test_bit() scenario is to explicitly check for return value of 1, so any value other than 1 causes kexec_status to return 0.

Great, however:
- please use "git format-patch -n ..." to create patches,
- first patch in the series should have [PATCH 0/3] in the subject,
- both patches lack of your SOB.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel