Re: [PATCH linux-next] x86:uaccess: fix boolreturn.cocci warnings
From: Nick Desaulniers
Date: Wed Aug 25 2021 - 15:30:38 EST
On Tue, Aug 24, 2021 at 12:18 AM CGEL <cgel.zte@xxxxxxxxx> wrote:
>
> From: Jing Yangyang <jing.yangyang@xxxxxxxxxx>
>
> ./arch/x86/include/asm/uaccess.h:477:9-10:WARNING:return of 0/1 in
> function 'user_access_begin' with return type bool
>
> Return statements in functions returning bool should use true/false
> instead of 1/0.
>
> Generated by: scripts/coccinelle/misc/boolreturn.cocci
>
> Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
> Signed-off-by: Jing Yangyang <jing.yangyang@xxxxxxxxxx>
Fixes: 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'")
Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> ---
> arch/x86/include/asm/uaccess.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> index c9fa7be..e3b6f4f 100644
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -474,9 +474,9 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
> static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
> {
> if (unlikely(!access_ok(ptr,len)))
> - return 0;
> + return false;
> __uaccess_begin_nospec();
> - return 1;
> + return true;
> }
> #define user_access_begin(a,b) user_access_begin(a,b)
> #define user_access_end() __uaccess_end()
> --
> 1.8.3.1
>
>
--
Thanks,
~Nick Desaulniers