Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@meta.com>
To: wuyonggang001@208suo.com, andrii@kernel.org, shuah@kernel.org
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix the address is NULL
Date: Wed, 14 Jun 2023 07:08:46 -0700	[thread overview]
Message-ID: <0b12a94a-e3e9-e2a2-389e-48a588d5ad6b@meta.com> (raw)
In-Reply-To: <7f34bd3ce377d9d89626c2df8fa584e0@208suo.com>



On 6/14/23 12:42 AM, wuyonggang001@208suo.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@208suo.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))
> 

  reply	other threads:[~2023-06-14 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230614073443.4894-1-zhanglibing@cdjrlc.com>
2023-06-14  7:42 ` [PATCH] selftests/bpf: Fix the address is NULL wuyonggang001
2023-06-14 14:08   ` Yonghong Song [this message]
2023-06-16 16:33     ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b12a94a-e3e9-e2a2-389e-48a588d5ad6b@meta.com \
    --to=yhs@meta.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=wuyonggang001@208suo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox