linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: "Bird, Tim" <Tim.Bird@sony.com>
Cc: Yang Li <yang.lee@linux.alibaba.com>,
	Shuah Khan <shuah@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/bpf: use !E instead of comparing with NULL
Date: Tue, 13 Apr 2021 09:13:24 -0700	[thread overview]
Message-ID: <CAADnVQJJ03L5H11P0NYNC9kYy=YkQdWrbpytB2Jps8AuxgamFA@mail.gmail.com> (raw)
In-Reply-To: <BN7PR13MB24996213858443821CA7E400FD4F9@BN7PR13MB2499.namprd13.prod.outlook.com>

On Tue, Apr 13, 2021 at 9:10 AM <Tim.Bird@sony.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> >
> > On Tue, Apr 13, 2021 at 2:52 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
> > >
> > > Fix the following coccicheck warnings:
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:189:7-11: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:361:7-11: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:386:14-18: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:402:14-18: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:433:7-11: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:534:14-18: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:625:7-11: WARNING
> > > comparing pointer to 0, suggest !E
> > > ./tools/testing/selftests/bpf/progs/profiler.inc.h:767:7-11: WARNING
> > > comparing pointer to 0, suggest !E
> > >
> > > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> > > ---
> > >  tools/testing/selftests/bpf/progs/profiler.inc.h | 22 +++++++++++-----------
> > >  1 file changed, 11 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > > index 4896fdf8..a33066c 100644
> > > --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > > +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > > @@ -189,7 +189,7 @@ static INLINE void populate_ancestors(struct task_struct* task,
> > >  #endif
> > >         for (num_ancestors = 0; num_ancestors < MAX_ANCESTORS; num_ancestors++) {
> > >                 parent = BPF_CORE_READ(parent, real_parent);
> > > -               if (parent == NULL)
> > > +               if (!parent)
> >
> > Sorry, but I'd like the progs to stay as close as possible to the way
> > they were written.
> Why?
>
> > They might not adhere to kernel coding style in some cases.
> > The code could be grossly inefficient and even buggy.
> There would have to be a really good reason to accept
> grossly inefficient and even buggy code into the kernel.
>
> Can you please explain what that reason is?

It's not the kernel. It's a test of bpf program.

  reply	other threads:[~2021-04-13 16:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  9:52 [PATCH] selftests/bpf: use !E instead of comparing with NULL Yang Li
2021-04-13 15:17 ` Alexei Starovoitov
2021-04-13 16:10   ` Tim.Bird
2021-04-13 16:13     ` Alexei Starovoitov [this message]
2021-04-13 16:19       ` Tim.Bird
2021-04-13 16:26         ` Alexei Starovoitov
2021-04-13 16:32           ` Tim.Bird
2021-04-13 16:56             ` Alexei Starovoitov
2021-04-13 17:22               ` Tim.Bird

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='CAADnVQJJ03L5H11P0NYNC9kYy=YkQdWrbpytB2Jps8AuxgamFA@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=Tim.Bird@sony.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yang.lee@linux.alibaba.com \
    --cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).