[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKwvOd=hoC3dM4cK0jLjPS1OUQ2k-nub5H4tQtDb3hB8NZnVzg@mail.gmail.com>
Date: Wed, 25 Aug 2021 12:30:21 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: CGEL <cgel.zte@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, Michael Ellerman <mpe@...erman.id.au>,
Dan Williams <dan.j.williams@...el.com>,
Uros Bizjak <ubizjak@...il.com>, linux-kernel@...r.kernel.org,
Jing Yangyang <jing.yangyang@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH linux-next] x86:uaccess: fix boolreturn.cocci warnings
On Tue, Aug 24, 2021 at 12:18 AM CGEL <cgel.zte@...il.com> wrote:
>
> From: Jing Yangyang <jing.yangyang@....com.cn>
>
> ./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@....com.cn>
> Signed-off-by: Jing Yangyang <jing.yangyang@....com.cn>
Fixes: 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'")
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
> 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
Powered by blists - more mailing lists