Subject: Re: [PATCH bpf-next v3 3/5] net: bonding: Add XDP support to the bonding driver

From: kernel test robot <[email-masked]>
Date: Tue, 13 Jul 2021 15:14:45 +0800

Hi Jussi,

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/Jussi-Maki/net-bonding-Refactor-bond_xmit_hash-for-use-with-xdp_buff/20210707-211616
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: m68k-randconfig-s032-20210713 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/127745a2455bc3577cdcafb06381fa4da354f8c2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jussi-Maki/net-bonding-Refactor-bond_xmit_hash-for-use-with-xdp_buff/20210707-211616
        git checkout 127745a2455bc3577cdcafb06381fa4da354f8c2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

sparse warnings: (new ones prefixed by >>)
   drivers/net/bonding/bond_main.c:2671:26: sparse: sparse: restricted __be16 degrades to integer
   drivers/net/bonding/bond_main.c:2677:20: sparse: sparse: restricted __be16 degrades to integer
   drivers/net/bonding/bond_main.c:2724:40: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] vlan_proto @@     got int @@
   drivers/net/bonding/bond_main.c:2724:40: sparse:     expected restricted __be16 [usertype] vlan_proto
   drivers/net/bonding/bond_main.c:2724:40: sparse:     got int
>> drivers/net/bonding/bond_main.c:4632:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct bond_up_slave *slaves @@     got struct bond_up_slave [noderef] __rcu *usable_slaves @@
   drivers/net/bonding/bond_main.c:4632:16: sparse:     expected struct bond_up_slave *slaves
   drivers/net/bonding/bond_main.c:4632:16: sparse:     got struct bond_up_slave [noderef] __rcu *usable_slaves
   drivers/net/bonding/bond_main.c:3563:52: sparse: sparse: restricted __be16 degrades to integer
   drivers/net/bonding/bond_main.c:3563:52: sparse: sparse: restricted __be16 degrades to integer

vim +4632 drivers/net/bonding/bond_main.c

  4623	
  4624	static struct slave *bond_xdp_xmit_3ad_xor_slave_get(struct bonding *bond,
  4625							     struct xdp_buff *xdp)
  4626	{
  4627		struct bond_up_slave *slaves;
  4628		unsigned int count;
  4629		u32 hash;
  4630	
  4631		hash = bond_xmit_hash_xdp(bond, xdp);
> 4632		slaves = bond->usable_slaves;
  4633		count = slaves ? READ_ONCE(slaves->count) : 0;
  4634		if (unlikely(!count))
  4635			return NULL;
  4636	
  4637		return slaves->arr[hash % count];
  4638	}
  4639	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]