linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition
@ 2021-11-05 16:27 Anders Roxell
  2021-11-05 20:17 ` Nick Desaulniers
  0 siblings, 1 reply; 3+ messages in thread
From: Anders Roxell @ 2021-11-05 16:27 UTC (permalink / raw)
  To: shuah
  Cc: nathan, ndesaulniers, linux-kselftest, linux-kernel, llvm, Anders Roxell

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@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition
  2021-11-05 16:27 [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition Anders Roxell
@ 2021-11-05 20:17 ` Nick Desaulniers
  2021-11-20  0:16   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Desaulniers @ 2021-11-05 20:17 UTC (permalink / raw)
  To: Anders Roxell; +Cc: shuah, nathan, linux-kselftest, linux-kernel, llvm

On Fri, Nov 5, 2021 at 9:28 AM Anders Roxell <anders.roxell@linaro.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@linaro.org>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition
  2021-11-05 20:17 ` Nick Desaulniers
@ 2021-11-20  0:16   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-11-20  0:16 UTC (permalink / raw)
  To: Nick Desaulniers, Anders Roxell
  Cc: shuah, nathan, linux-kselftest, linux-kernel, llvm, Shuah Khan

On 11/5/21 2:17 PM, Nick Desaulniers wrote:
> On Fri, Nov 5, 2021 at 9:28 AM Anders Roxell <anders.roxell@linaro.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@linaro.org>
> 
> Thanks for the patch!
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> 

My commit script failed due to checkpatch warns. Run checkpatchp.l --strict
to find the problems and send me the fixed version.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-20  0:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 16:27 [PATCH] selftests: vDSO: parse: warning: fix assignment as a condition Anders Roxell
2021-11-05 20:17 ` Nick Desaulniers
2021-11-20  0:16   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).