[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b12a94a-e3e9-e2a2-389e-48a588d5ad6b@meta.com>
Date: Wed, 14 Jun 2023 07:08:46 -0700
From: Yonghong Song <yhs@...a.com>
To: wuyonggang001@...suo.com, andrii@...nel.org, shuah@...nel.org
Cc: bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix the address is NULL
On 6/14/23 12:42 AM, wuyonggang001@...suo.com wrote:
> Fix the following coccicheck error:
>
> tools/testing/selftests/bpf/progs/test_ksyms_weak.c:53:6-20: ERROR: test
> of a variable/field address
I didn't see clang/gcc compiler warns about this. Maybe need some
additional flags beyond what current selftest/bpf already has
in order to trigger this warning?
If you feel this warning has some merit, could you propose
it to gcc/llvm community?
>
> Signed-off-by: Yonggang Wu <wuyonggang001@...suo.com>
> ---
> tools/testing/selftests/bpf/progs/test_ksyms_weak.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> index d00268c91e19..768a4d6ee6f5 100644
> --- a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> +++ b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> @@ -50,7 +50,7 @@ int pass_handler(const void *ctx)
> /* tests non-existent symbols. */
> out__non_existent_typed = (__u64)&bpf_link_fops2;
>
> - if (&bpf_link_fops2) /* can't happen */
> + if (&bpf_link_fops2 != NULL) /* can't happen */
> out__non_existent_typed =
> (__u64)bpf_per_cpu_ptr(&bpf_link_fops2, 0);
>
> if (!bpf_ksym_exists(bpf_task_acquire))
>
Powered by blists - more mailing lists