[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191003191318.q6jvzuf46gjygpux@wittgenstein>
Date: Thu, 3 Oct 2019 21:13:18 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Nathan Chancellor <natechancellor@...il.com>
Cc: Aleksa Sarai <cyphar@...har.com>,
Kees Cook <keescook@...omium.org>,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] usercopy: Add parentheses around assignment in
test_copy_struct_from_user
On Thu, Oct 03, 2019 at 10:11:21AM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> lib/test_user_copy.c:96:10: warning: using the result of an assignment
> as a condition without parentheses [-Wparentheses]
> if (ret |= test(umem_src == NULL, "kmalloc failed"))
> ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/test_user_copy.c:96:10: note: place parentheses around the
> assignment to silence this warning
> if (ret |= test(umem_src == NULL, "kmalloc failed"))
> ^
> ( )
> lib/test_user_copy.c:96:10: note: use '!=' to turn this compound
> assignment into an inequality comparison
> if (ret |= test(umem_src == NULL, "kmalloc failed"))
> ^~
> !=
>
> Add the parentheses as it suggests because this is intentional.
>
> Fixes: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper")
> Link: https://github.com/ClangBuiltLinux/linux/issues/731
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Applied to:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=copy_struct_from_user
Thanks!
Christian
Powered by blists - more mailing lists