* [linux-next:master 6746/7265] tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086
@ 2022-04-27 8:10 kernel test robot
2022-04-27 8:04 ` [PATCH] libbpf: fix returnvar.cocci warnings kernel test robot
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-04-27 8:10 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: kbuild-all, Linux Memory Management List, Alexei Starovoitov
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
config: sparc-randconfig-c023-20220425 (https://download.01.org/0day-ci/archive/20220427/202204271656.OTIj2QNJ-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cocci warnings: (new ones prefixed by >>)
>> tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086
Please review and possibly fold the followup patch.
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] libbpf: fix returnvar.cocci warnings 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 ` kernel test robot 2022-04-27 16:07 ` Alexei Starovoitov 0 siblings, 1 reply; 4+ messages in thread From: kernel test robot @ 2022-04-27 8:04 UTC (permalink / raw) To: Andrii Nakryiko Cc: kbuild-all, Linux Memory Management List, Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf, linux-kernel 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; if (core_relo_is_enumval_based(spec->relo_kind)) { t = skip_mods_and_typedefs(spec->btf, type_id, NULL); @@ -1091,7 +1091,7 @@ static int bpf_core_format_spec(char *bu s = btf__name_by_offset(spec->btf, e->name_off); append_buf("::%s = %u", s, e->val); - return len; + return 0; } if (core_relo_is_field_based(spec->relo_kind)) { @@ -1110,10 +1110,10 @@ static int bpf_core_format_spec(char *bu append_buf(" @ offset %u.%u)", spec->bit_offset / 8, spec->bit_offset % 8); else append_buf(" @ offset %u)", spec->bit_offset / 8); - return len; + return 0; } - return len; + return 0; #undef append_buf } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libbpf: fix returnvar.cocci warnings 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 0 siblings, 1 reply; 4+ messages in thread From: Alexei Starovoitov @ 2022-04-27 16:07 UTC (permalink / raw) To: kernel test robot, Julia Lawall Cc: Andrii Nakryiko, kbuild-all, Linux Memory Management List, Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Network Development, bpf, LKML 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. Please fix cocci so we don't have to manually deal with broken patches like this one. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libbpf: fix returnvar.cocci warnings 2022-04-27 16:07 ` Alexei Starovoitov @ 2022-04-28 16:22 ` Andrii Nakryiko 0 siblings, 0 replies; 4+ messages in thread From: Andrii Nakryiko @ 2022-04-28 16:22 UTC (permalink / raw) To: Alexei Starovoitov Cc: kernel test robot, Julia Lawall, Andrii Nakryiko, kbuild-all, Linux Memory Management List, Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Network Development, bpf, LKML 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-28 16:23 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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).