[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=dtb98Ue1xYz0gQmRGeQWdH6sBEkpXioevPQ94envK8A@mail.gmail.com>
Date: Fri, 5 Nov 2021 13:17:14 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Anders Roxell <anders.roxell@...aro.org>
Cc: shuah@...nel.org, nathan@...nel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition
On Fri, Nov 5, 2021 at 9:28 AM Anders Roxell <anders.roxell@...aro.org> wrote:
>
> When building selftests/vDSO with clang the following warning shows up:
>
> clang -std=gnu99 -Wno-pointer-sign vdso_test_gettimeofday.c parse_vdso.c -o /home/anders/.cache/tuxmake/builds/current/kselftest/vDSO/vdso_test_gettimeofday
> parse_vdso.c:65:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
> if (g = h & 0xf0000000)
> ~~^~~~~~~~~~~~~~~~
>
> Rework to a parentheses before doing the check.
>
> Signed-off-by: Anders Roxell <anders.roxell@...aro.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
> tools/testing/selftests/vDSO/parse_vdso.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
> index 413f75620a35..b47b721a4ea4 100644
> --- a/tools/testing/selftests/vDSO/parse_vdso.c
> +++ b/tools/testing/selftests/vDSO/parse_vdso.c
> @@ -62,7 +62,7 @@ static unsigned long elf_hash(const unsigned char *name)
> while (*name)
> {
> h = (h << 4) + *name++;
> - if (g = h & 0xf0000000)
> + if ((g = (h & 0xf0000000)))
> h ^= g >> 24;
> h &= ~g;
> }
> --
> 2.33.0
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists