On Thu, Jan 19, 2017 at 11:10:53AM -0600, Eric DeVolder wrote:
> When checking kexec_flags bit corresponding to the
> requested image, ensure that 0 or 1 is returned.
>
> Signed-off-by: Eric DeVolder <eric.devol...@oracle.com>

In general Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com> but...

> ---
>  xen/common/kexec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/kexec.c b/xen/common/kexec.c
> index aa808cb..3da27bf 100644
> --- a/xen/common/kexec.c
> +++ b/xen/common/kexec.c
> @@ -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.

> +    return !!test_bit(bit, &kexec_flags);

Daniel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to