net/sched/act_bpf.c:132:35: sparse: sparse: incorrect type in argument 2 (different address spaces)

From: kernel test robot
Date: Thu Jul 09 2020 - 08:56:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 3 weeks ago
config: sh-randconfig-s031-20200709 (attached as .config)
compiler: sh4-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.2-37-gc9676a3b-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# 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=sh

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/sched/act_bpf.c:132:35: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *__from @@ got unsigned char [noderef] __rcu * @@
net/sched/act_bpf.c:132:35: sparse: expected void const *__from
net/sched/act_bpf.c:132:35: sparse: got unsigned char [noderef] __rcu *
net/sched/act_bpf.c:125:50: sparse: sparse: dereference of noderef expression
net/sched/act_bpf.c:125:50: sparse: sparse: dereference of noderef expression

vim +132 net/sched/act_bpf.c

a8cb5f556b5679 Daniel Borkmann 2015-03-20 115
a8cb5f556b5679 Daniel Borkmann 2015-03-20 116 static int tcf_bpf_dump_ebpf_info(const struct tcf_bpf *prog,
a8cb5f556b5679 Daniel Borkmann 2015-03-20 117 struct sk_buff *skb)
a8cb5f556b5679 Daniel Borkmann 2015-03-20 118 {
7bd509e311f408 Daniel Borkmann 2016-12-04 119 struct nlattr *nla;
7bd509e311f408 Daniel Borkmann 2016-12-04 120
a8cb5f556b5679 Daniel Borkmann 2015-03-20 121 if (prog->bpf_name &&
a8cb5f556b5679 Daniel Borkmann 2015-03-20 122 nla_put_string(skb, TCA_ACT_BPF_NAME, prog->bpf_name))
a8cb5f556b5679 Daniel Borkmann 2015-03-20 123 return -EMSGSIZE;
a8cb5f556b5679 Daniel Borkmann 2015-03-20 124
e86283071fb0ee Daniel Borkmann 2017-06-21 125 if (nla_put_u32(skb, TCA_ACT_BPF_ID, prog->filter->aux->id))
e86283071fb0ee Daniel Borkmann 2017-06-21 126 return -EMSGSIZE;
e86283071fb0ee Daniel Borkmann 2017-06-21 127
f1f7714ea51c56 Daniel Borkmann 2017-01-13 128 nla = nla_reserve(skb, TCA_ACT_BPF_TAG, sizeof(prog->filter->tag));
7bd509e311f408 Daniel Borkmann 2016-12-04 129 if (nla == NULL)
7bd509e311f408 Daniel Borkmann 2016-12-04 130 return -EMSGSIZE;
7bd509e311f408 Daniel Borkmann 2016-12-04 131
f1f7714ea51c56 Daniel Borkmann 2017-01-13 @132 memcpy(nla_data(nla), prog->filter->tag, nla_len(nla));
7bd509e311f408 Daniel Borkmann 2016-12-04 133
a8cb5f556b5679 Daniel Borkmann 2015-03-20 134 return 0;
a8cb5f556b5679 Daniel Borkmann 2015-03-20 135 }
a8cb5f556b5679 Daniel Borkmann 2015-03-20 136

:::::: The code at line 132 was first introduced by commit
:::::: f1f7714ea51c56b7163fb1a5acf39c6a204dd758 bpf: rework prog_digest into prog_tag

:::::: TO: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip