Followup corrections for kexec_status()
cover Followup corrections for kexec_status()
Jan,
This corrects the use of test_bit() in kexec_status().
Wei,
This patch is against the kexec_status() recently applied to staging.
Regards,
Eric
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/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.
--- xen/common/kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/kexec.c +2 -1
@@ -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,
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1
Quoted 4 lines · Eric DeVolder
When checking
kexec_flagsbit corresponding to the requested image, ensure that 0 or 1 is returned.Signed-off-by Eric DeVolder <[email protected]>
In general Reviewed-by: Daniel Kiper <[email protected]> but...
Quoted 9 lines
--- xen/common/kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)xen/common/kexec.c +0
-0
xen/common/kexec.c static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) uarg) · line 1185
Quoted 5 lines
xen/common/kexec.c +1
-1@@ -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 */
This is not needed here. "!!" is used very often and it is not an unusual stuff. So, it does not need any comment. However, I can agree that at first sight it looks strange.
xen/common/kexec.c static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) uarg) · line 1186
Quoted 1 line
xen/common/kexec.c +1
-0+return !!test_bit (bit, &kexec_flags);
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1
In reply to Eric DeVolderxen/common/kexec.c static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) uarg) · line 1187
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 19.01.17 at 18:10, <[email protected]> wrote:
xen/common/kexec.c +2
-1@@ -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); }
I don't see the point of adding a comment here, but I'll let Andrew as the maintainer judge. In any event
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 1/1] kexec: ensure kexec_status() return bit value of 0 or 1
In reply to Eric DeVolderQuoted 4 lines · Eric DeVolder
When checking
kexec_flagsbit corresponding to the requested image, ensure that 0 or 1 is returned.Signed-off-by Eric DeVolder <[email protected]>
dropped the commit while doing so
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel