From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0929206569240873308==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] bpf: fix itnull.cocci warnings Date: Tue, 12 Jan 2021 05:56:17 +0800 Message-ID: <20210111215617.GA38798@fd8e3aebcf75> In-Reply-To: <202101120529.xXBTJbWt-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============0929206569240873308== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org In-Reply-To: <1610386373-24162-2-git-send-email-alan.maguire@oracle.com> References: <1610386373-24162-2-git-send-email-alan.maguire@oracle.com> TO: Alan Maguire From: kernel test robot kernel/bpf/btf_show_common.c:1111:6-7: ERROR: iterator variable bound on li= ne 1109 cannot be NULL Many iterators have the property that the first argument is always bound to a real list element, never NULL. Semantic patch information: False positives arise for some iterators that do not have this property, or in cases when the loop cursor is reassigned. The latter should only happen when the matched code is on the way to a loop exit (break, goto, or return). Generated by: scripts/coccinelle/iterators/itnull.cocci CC: Alan Maguire Reported-by: kernel test robot Signed-off-by: kernel test robot --- url: https://github.com/0day-ci/linux/commits/Alan-Maguire/bpf-libbpf-sh= are-BTF-data-show-functionality/20210112-013917 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git ma= ster :::::: branch date: 4 hours ago :::::: commit date: 4 hours ago Please take the patch only if it's a positive warning. Thanks! btf_show_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/bpf/btf_show_common.c +++ b/kernel/bpf/btf_show_common.c @@ -1108,8 +1108,7 @@ void btf_datasec_show(const struct btf * __btf_name_by_offset(btf, t->name_off)); for_each_vsi(i, t, vsi) { var =3D btf_type_by_id(btf, vsi->type); - if (i) - btf_show(show, ","); + btf_show(show, ","); btf_type_ops_show(btf, var, vsi->type, data + vsi->offset, bits_offset, show); } --===============0929206569240873308==--