kexec: followup to STATUS patch v3 already in staging
PATCH 1/1 kexec: followup to STATUS patch v3 already in staging
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
PATCH 1/2 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
@@ -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
PATCH 2/2 kexec: ensure kexec_status() always returns 0 or 1
In reply to Eric DeVolderThe 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
@@ -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
Re: [PATCH 1/2] Put back blank line for readability purposes.
In reply to Eric DeVolderQuoted 4 lines · Eric DeVolder
This blank line was accidentally removed during
the insertion of thekexec_status()declarations.Signed-off-by Eric DeVolder <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] kexec: ensure kexec_status() always returns 0 or 1
In reply to Eric DeVolderQuoted 6 lines · Eric DeVolder
The use of
test_bit()can also return EPERM, so the return value fromtest_bit()must be checked to ensure thatkexec_status()always returns 0, 1 or -1, per the public header description.Signed-off-by Eric DeVolder <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
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 oftest_bit()can also return EPERM, so the return value fromtest_bit()must be checked to ensure thatkexec_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 causeskexec_statusto return 0.
One nitpick. Subject should be:
[PATCH v2 0/2] kexec: followup to STATUS patch v3 already in staging
and then following patches should have in subject:
[PATCH v2 1/2] ...
[PATCH v2 2/2] ...
However, IMO regardless of that patches can go in.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] kexec: ensure kexec_status() always returns 0 or 1
In reply to Eric DeVolderQuoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.01.17 at 22:47, <[email protected]> wrote:
The use of
test_bit()can also return EPERM, so the return value fromtest_bit()must be checked to ensure thatkexec_status()always returns 0, 1 or -1, per the public header description.
Well, no, and this is rather disappointing. Did you look at the test_bit() implementation, as I did suggest you do? As said before, it returns non-zero if the bit was set, and zero if it was clear. It won't ever return -EPERM (it was only your original code which converted the meaning of ~0 to -EPERM). Hence the result here isn't much better than the original.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] kexec: ensure kexec_status() always returns 0 or 1
Quoted 6 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.01.17 at 22:47, <[email protected]> wrote:
The use of
test_bit()can also return EPERM, so the return value fromtest_bit()must be checked to ensure thatkexec_status()always returns 0, 1 or -1, per the public header description.
Quoted 6 lines
Well, no, and this is rather disappointing. Did you look at the
test_bit()implementation, as I did suggest you do? As said before, it returns non-zero if the bit was set, and zero if it was clear. It won't ever return-EPERM(it was only your original code which converted the meaning of ~0 to-EPERM). Hence the result here isn't much better than the original.
Errr... It looks that I have checked incorrect test_bit() implementation and my Reviewed-by was skewed. Sorry about that. Jan is right. You must use "!!" instead of "... == 1". And commit message is also incorrect...
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel