From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: kernel test robot <lkp@intel.com>,
Julia Lawall <julia.lawall@inria.fr>,
Andrii Nakryiko <andrii@kernel.org>,
kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
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>,
Network Development <netdev@vger.kernel.org>,
bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] libbpf: fix returnvar.cocci warnings
Date: Thu, 28 Apr 2022 09:22:53 -0700 [thread overview]
Message-ID: <CAEf4BzZDmOWy+q_sqW7ziSjdqgZ9c7hGDkD4TKjAQ9dzN0_-ug@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQLSfbc8rNQC+0rGxgJCbXYCENsAORZmiXqcXc+W0N8A0g@mail.gmail.com>
On Wed, Apr 27, 2022 at 9:07 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Apr 27, 2022 at 1:04 AM kernel test robot <lkp@intel.com> wrote:
> >
> > From: kernel test robot <lkp@intel.com>
> >
> > tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086
> >
> >
> > Remove unneeded variable used to store return value.
> >
> > Generated by: scripts/coccinelle/misc/returnvar.cocci
> >
> > Fixes: b58af63aab11 ("libbpf: Refactor CO-RE relo human description formatting routine")
> > CC: Andrii Nakryiko <andrii@kernel.org>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: kernel test robot <lkp@intel.com>
> > ---
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: f02ac5c95dfd45d2f50ecc68d79177de326c668c
> > commit: b58af63aab11e4ae00fe96de9505759cfdde8ee9 [6746/7265] libbpf: Refactor CO-RE relo human description formatting routine
> > :::::: branch date: 2 hours ago
> > :::::: commit date: 9 hours ago
> >
> > tools/lib/bpf/relo_core.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > --- a/tools/lib/bpf/relo_core.c
> > +++ b/tools/lib/bpf/relo_core.c
> > @@ -1061,7 +1061,7 @@ static int bpf_core_format_spec(char *bu
> > const struct btf_enum *e;
> > const char *s;
> > __u32 type_id;
> > - int i, len = 0;
> > + int i;
> >
> > #define append_buf(fmt, args...) \
> > ({ \
> > @@ -1083,7 +1083,7 @@ static int bpf_core_format_spec(char *bu
> > type_id, btf_kind_str(t), str_is_empty(s) ? "<anon>" : s);
> >
> > if (core_relo_is_type_based(spec->relo_kind))
> > - return len;
> > + return 0;
>
> cocci is wrong.
> It missed append_buf() macro.
Should be irrelevant once [0] lands. It makes use of that return value directly.
[0] https://patchwork.kernel.org/project/netdevbpf/patch/20220428041523.4089853-2-andrii@kernel.org/
>
> Please fix cocci so we don't have to manually deal with
> broken patches like this one.
prev parent reply other threads:[~2022-04-28 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 8:10 [linux-next:master 6746/7265] tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086 kernel test robot
2022-04-27 8:04 ` [PATCH] libbpf: fix returnvar.cocci warnings kernel test robot
2022-04-27 16:07 ` Alexei Starovoitov
2022-04-28 16:22 ` Andrii Nakryiko [this message]
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=CAEf4BzZDmOWy+q_sqW7ziSjdqgZ9c7hGDkD4TKjAQ9dzN0_-ug@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=julia.lawall@inria.fr \
--cc=kafai@fb.com \
--cc=kbuild-all@lists.01.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.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