Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: wuyonggang001@208suo.com
To: andrii@kernel.org, shuah@kernel.org
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/bpf: Fix the address is NULL
Date: Wed, 14 Jun 2023 15:42:34 +0800	[thread overview]
Message-ID: <7f34bd3ce377d9d89626c2df8fa584e0@208suo.com> (raw)
In-Reply-To: <20230614073443.4894-1-zhanglibing@cdjrlc.com>

Fix the following coccicheck error:

tools/testing/selftests/bpf/progs/test_ksyms_weak.c:53:6-20: ERROR: test 
of a variable/field address

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  7:42 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 ` wuyonggang001 [this message]
2023-06-14 14:08   ` [PATCH] selftests/bpf: Fix the address is NULL Yonghong Song
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=7f34bd3ce377d9d89626c2df8fa584e0@208suo.com \
    --to=wuyonggang001@208suo.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 \
    /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