net/ipv4/netfilter/arp_tables.c:1382:56: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Wed Dec 16 2020 - 05:33:28 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d01e7f10dae29eba0f9ada82b65d24e035d5b2f9
commit: cc00bcaa589914096edef7fb87ca5cee4a166b5c netfilter: x_tables: Switch synchronization to RCU
date: 8 days ago
config: s390-randconfig-s032-20201216 (attached as .config)
compiler: s390-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-184-g1b896707-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc00bcaa589914096edef7fb87ca5cee4a166b5c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout cc00bcaa589914096edef7fb87ca5cee4a166b5c
# 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=s390

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


"sparse warnings: (new ones prefixed by >>)"
net/ipv4/netfilter/arp_tables.c:1057:48: sparse: sparse: array of flexible structures
net/ipv4/netfilter/arp_tables.c:1359:44: sparse: sparse: array of flexible structures
>> net/ipv4/netfilter/arp_tables.c:1382:56: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct xt_table_info const *private @@ got struct xt_table_info [noderef] __rcu *private @@
net/ipv4/netfilter/arp_tables.c:1382:56: sparse: expected struct xt_table_info const *private
net/ipv4/netfilter/arp_tables.c:1382:56: sparse: got struct xt_table_info [noderef] __rcu *private
net/ipv4/netfilter/arp_tables.c:40:16: sparse: sparse: Initializer entry defined twice
net/ipv4/netfilter/arp_tables.c:40:16: sparse: also defined here
net/ipv4/netfilter/arp_tables.c:40:16: sparse: sparse: Initializer entry defined twice
net/ipv4/netfilter/arp_tables.c:40:16: sparse: also defined here

vim +1382 net/ipv4/netfilter/arp_tables.c

d6a2ba07c31b049 Patrick McHardy 2007-12-17 1361
79df341ab6c0b1e Alexey Dobriyan 2008-01-31 1362 static int compat_get_entries(struct net *net,
79df341ab6c0b1e Alexey Dobriyan 2008-01-31 1363 struct compat_arpt_get_entries __user *uptr,
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1364 int *len)
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1365 {
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1366 int ret;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1367 struct compat_arpt_get_entries get;
4abff0775d5e4fe Jan Engelhardt 2008-04-14 1368 struct xt_table *t;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1369
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03 1370 if (*len < sizeof(get))
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1371 return -EINVAL;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1372 if (copy_from_user(&get, uptr, sizeof(get)) != 0)
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1373 return -EFAULT;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03 1374 if (*len != sizeof(struct compat_arpt_get_entries) + get.size)
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1375 return -EINVAL;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03 1376
b301f2538759933 Pablo Neira Ayuso 2016-03-24 1377 get.name[sizeof(get.name) - 1] = '\0';
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1378
ee999d8b9573df1 Jan Engelhardt 2008-10-08 1379 xt_compat_lock(NFPROTO_ARP);
ee999d8b9573df1 Jan Engelhardt 2008-10-08 1380 t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
03d13b6868a261f Florian Westphal 2017-12-08 1381 if (!IS_ERR(t)) {
5452e425adfdfc4 Jan Engelhardt 2008-04-14 @1382 const struct xt_table_info *private = t->private;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1383 struct xt_table_info info;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1384
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1385 ret = compat_table_info(private, &info);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1386 if (!ret && get.size == info.size) {
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1387 ret = compat_copy_entries_to_user(private->size,
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1388 t, uptr->entrytable);
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03 1389 } else if (!ret)
544473c1664f3a6 Patrick McHardy 2008-04-14 1390 ret = -EAGAIN;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03 1391
ee999d8b9573df1 Jan Engelhardt 2008-10-08 1392 xt_compat_flush_offsets(NFPROTO_ARP);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1393 module_put(t->me);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1394 xt_table_unlock(t);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1395 } else
03d13b6868a261f Florian Westphal 2017-12-08 1396 ret = PTR_ERR(t);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1397
ee999d8b9573df1 Jan Engelhardt 2008-10-08 1398 xt_compat_unlock(NFPROTO_ARP);
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1399 return ret;
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1400 }
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1401 #endif
d6a2ba07c31b049 Patrick McHardy 2007-12-17 1402

:::::: The code at line 1382 was first introduced by commit
:::::: 5452e425adfdfc4647b618e303f73d48f2405b0e [NETFILTER]: annotate {arp,ip,ip6,x}tables with const

:::::: TO: Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx>
:::::: CC: Patrick McHardy <kaber@xxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip