Content-Type: multipart/mixed; boundary="===============6962484604714804870==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v7 bpf-next 09/14] bpd: add multi-buffer support to xdp copy helpers Date: Sat, 20 Mar 2021 11:47:00 +0800 Message-ID: <202103201112.Qq22IgkP-lkp@intel.com> In-Reply-To: List-Id: --===============6962484604714804870== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Lorenzo, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mvneta-in= troduce-XDP-multi-buffer-support/20210320-055103 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git ma= ster compiler: nios2-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot cppcheck warnings: (new ones prefixed by >>) ^ net/core/filter.c:10085:6: note: Variable 'ret' is reassigned a value be= fore the old one has been used. ret =3D -EACCES; ^ net/core/filter.c:10090:6: note: Variable 'ret' is reassigned a value be= fore the old one has been used. ret =3D fprog->len; ^ >> net/core/filter.c:4593:30: warning: Uninitialized variable: copy_len [un= initvar] memcpy(dst_buff, src_buff, copy_len); ^ vim +4593 net/core/filter.c 4551 = 4552 static unsigned long bpf_xdp_copy(void *dst_buff, const void *ctx, 4553 unsigned long off, unsigned long len) 4554 { 4555 struct xdp_buff *xdp =3D (struct xdp_buff *)ctx; 4556 struct xdp_shared_info *xdp_sinfo; 4557 unsigned long base_len; 4558 const void *src_buff; 4559 = 4560 if (likely(!xdp->mb)) { 4561 src_buff =3D xdp->data; 4562 memcpy(dst_buff, src_buff + off, len); 4563 = 4564 return 0; 4565 } 4566 = 4567 base_len =3D xdp->data_end - xdp->data; 4568 xdp_sinfo =3D xdp_get_shared_info_from_buff(xdp); 4569 do { 4570 unsigned long copy_len; 4571 = 4572 if (off < base_len) { 4573 src_buff =3D xdp->data + off; 4574 copy_len =3D min(len, base_len - off); 4575 } else { 4576 unsigned long frag_off_total =3D base_len; 4577 int i; 4578 = 4579 for (i =3D 0; i < xdp_sinfo->nr_frags; i++) { 4580 skb_frag_t *frag =3D &xdp_sinfo->frags[i]; 4581 unsigned long frag_len =3D xdp_get_frag_size(frag); 4582 unsigned long frag_off =3D off - frag_off_total; 4583 = 4584 if (frag_off < frag_len) { 4585 src_buff =3D xdp_get_frag_address(frag) + 4586 frag_off; 4587 copy_len =3D min(len, frag_len - frag_off); 4588 break; 4589 } 4590 frag_off_total +=3D frag_len; 4591 } 4592 } > 4593 memcpy(dst_buff, src_buff, copy_len); 4594 off +=3D copy_len; 4595 len -=3D copy_len; 4596 dst_buff +=3D copy_len; 4597 } while (len); 4598 = 4599 return 0; 4600 } 4601 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============6962484604714804870==--