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

From: kernel test robot
Date: Thu Jul 02 2020 - 06:35:26 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cd77006e01b3198c75fb7819b3d0ff89709539bb
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 2 weeks ago
config: x86_64-randconfig-s021-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-3-gfa153962-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

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