netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	lorenzo.bianconi@redhat.com, davem@davemloft.net,
	kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	shayagr@amazon.com, john.fastabend@gmail.com, dsahern@kernel.org
Subject: Re: [PATCH v7 bpf-next 09/14] bpd: add multi-buffer support to xdp copy helpers
Date: Sat, 20 Mar 2021 08:51:23 +0800	[thread overview]
Message-ID: <202103200854.hVTC06V7-lkp@intel.com> (raw)
In-Reply-To: <d7e913be6855a2aeaaff16de39960b38afd06da7.1616179034.git.lorenzo@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 4008 bytes --]

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-introduce-XDP-multi-buffer-support/20210320-055103
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm-randconfig-r023-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 436c6c9c20cc522c92a923440a5fc509c342a7db)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/9603affe766576f892f3a8e02d58dbe83092c74a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lorenzo-Bianconi/mvneta-introduce-XDP-multi-buffer-support/20210320-055103
        git checkout 9603affe766576f892f3a8e02d58dbe83092c74a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/core/filter.c:4579:16: warning: variable 'copy_len' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
                           for (i = 0; i < xdp_sinfo->nr_frags; i++) {
                                       ^~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:4593:30: note: uninitialized use occurs here
                   memcpy(dst_buff, src_buff, copy_len);
                                              ^~~~~~~~
   net/core/filter.c:4579:16: note: remove the condition if it is always true
                           for (i = 0; i < xdp_sinfo->nr_frags; i++) {
                                       ^~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:4570:25: note: initialize the variable 'copy_len' to silence this warning
                   unsigned long copy_len;
                                         ^
                                          = 0
   1 warning generated.


vim +4579 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 = (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 = xdp->data;
  4562			memcpy(dst_buff, src_buff + off, len);
  4563	
  4564			return 0;
  4565		}
  4566	
  4567		base_len = xdp->data_end - xdp->data;
  4568		xdp_sinfo = xdp_get_shared_info_from_buff(xdp);
  4569		do {
  4570			unsigned long copy_len;
  4571	
  4572			if (off < base_len) {
  4573				src_buff = xdp->data + off;
  4574				copy_len = min(len, base_len - off);
  4575			} else {
  4576				unsigned long frag_off_total = base_len;
  4577				int i;
  4578	
> 4579				for (i = 0; i < xdp_sinfo->nr_frags; i++) {
  4580					skb_frag_t *frag = &xdp_sinfo->frags[i];
  4581					unsigned long frag_len = xdp_get_frag_size(frag);
  4582					unsigned long frag_off = off - frag_off_total;
  4583	
  4584					if (frag_off < frag_len) {
  4585						src_buff = xdp_get_frag_address(frag) +
  4586							   frag_off;
  4587						copy_len = min(len, frag_len - frag_off);
  4588						break;
  4589					}
  4590					frag_off_total += frag_len;
  4591				}
  4592			}
  4593			memcpy(dst_buff, src_buff, copy_len);
  4594			off += copy_len;
  4595			len -= copy_len;
  4596			dst_buff += 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@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35941 bytes --]

  reply	other threads:[~2021-03-20  0:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 21:47 [PATCH v7 bpf-next 00/14] mvneta: introduce XDP multi-buffer support Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 01/14] xdp: introduce mb in xdp_buff/xdp_frame Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 02/14] xdp: add xdp_shared_info data structure Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 03/14] net: mvneta: update mb bit before passing the xdp buffer to eBPF layer Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 04/14] xdp: add multi-buff support to xdp_return_{buff/frame} Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 05/14] net: mvneta: add multi buffer support to XDP_TX Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 06/14] net: mvneta: enable jumbo frames for XDP Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 07/14] net: xdp: add multi-buff support to xdp_build_skb_from_fram Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 08/14] bpf: add multi-buff support to the bpf_xdp_adjust_tail() API Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 09/14] bpd: add multi-buffer support to xdp copy helpers Lorenzo Bianconi
2021-03-20  0:51   ` kernel test robot [this message]
2021-03-20  3:47   ` kernel test robot
2021-03-19 21:47 ` [PATCH v7 bpf-next 10/14] bpf: add new frame_length field to the XDP ctx Lorenzo Bianconi
2021-03-20  3:42   ` David Ahern
2021-03-22  9:29     ` Eelco Chaudron
2021-03-22 15:05       ` David Ahern
2021-03-19 21:47 ` [PATCH v7 bpf-next 11/14] bpf: move user_size out of bpf_test_init Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 12/14] bpf: introduce multibuff support to bpf_prog_test_run_xdp() Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 13/14] bpf: test_run: add xdp_shared_info pointer in bpf_test_finish signature Lorenzo Bianconi
2021-03-19 21:47 ` [PATCH v7 bpf-next 14/14] bpf: update xdp_adjust_tail selftest to include multi-buffer Lorenzo Bianconi

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=202103200854.hVTC06V7-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shayagr@amazon.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).