[congwang:sch_bpf 2/2] net/sched/sch_bpf.c:168:27: sparse: sparse: incompatible types in comparison expression (different address spaces):

From: kernel test robot
Date: Sat Aug 14 2021 - 01:26:58 EST


tree: https://github.com/congwang/linux.git sch_bpf
head: 0ad458bc4f0d7706cb35ddbf35a148527c382d26
commit: 0ad458bc4f0d7706cb35ddbf35a148527c382d26 [2/2] sch_bpf: draft
config: nios2-randconfig-s031-20210814 (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.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-348-gf0e6938b-dirty
# https://github.com/congwang/linux/commit/0ad458bc4f0d7706cb35ddbf35a148527c382d26
git remote add congwang https://github.com/congwang/linux.git
git fetch --no-tags congwang sch_bpf
git checkout 0ad458bc4f0d7706cb35ddbf35a148527c382d26
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2 SHELL=/bin/bash net/sched/

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/sch_bpf.c:168:27: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> net/sched/sch_bpf.c:168:27: sparse: struct bpf_prog [noderef] __rcu *
>> net/sched/sch_bpf.c:168:27: sparse: struct bpf_prog *
net/sched/sch_bpf.c:238:19: sparse: sparse: incompatible types in comparison expression (different address spaces):
net/sched/sch_bpf.c:238:19: sparse: struct bpf_prog [noderef] __rcu *
net/sched/sch_bpf.c:238:19: sparse: struct bpf_prog *

vim +168 net/sched/sch_bpf.c

154
155 static int sch_bpf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
156 struct sk_buff **to_free)
157 {
158 struct sch_bpf_qdisc *q = qdisc_priv(sch);
159 unsigned int len = qdisc_pkt_len(skb);
160 struct sch_bpf_ctx ctx = {};
161 struct sch_bpf_class *cl;
162 int res;
163
164 cl = sch_bpf_classify(skb, sch, &res);
165 if (!cl) {
166 struct bpf_prog *enqueue;
167
> 168 enqueue = rcu_dereference(q->enqueue_prog.prog);
169 bpf_compute_data_pointers(skb);
170
171 ctx.skb = (struct __sk_buff *)skb;
172 ctx.nr_flows = q->clhash.hashelems;
173 ctx.nr_packets = sch->q.qlen;
174 res = BPF_PROG_RUN(enqueue, &ctx);
175 if (res == SCH_BPF_RET_DROP) {
176 __qdisc_drop(skb, to_free);
177 return NET_XMIT_DROP;
178 }
179 cl = sch_bpf_find(sch, ctx.classid);
180 if (!cl) {
181 if (res & __NET_XMIT_BYPASS)
182 qdisc_qstats_drop(sch);
183 __qdisc_drop(skb, to_free);
184 return res;
185 }
186 }
187
188 if (cl->qdisc) {
189 res = qdisc_enqueue(skb, cl->qdisc, to_free);
190 if (res != NET_XMIT_SUCCESS) {
191 if (net_xmit_drop_count(res)) {
192 qdisc_qstats_drop(sch);
193 cl->drops++;
194 }
195 return res;
196 }
197 } else {
198 sch_bpf_skb_cb(skb)->rank = ctx.rank;
199 pq_push(&cl->pq, &skb->pqnode);
200 }
201
202 sch->qstats.backlog += len;
203 sch->q.qlen++;
204 return res;
205 }
206

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

Attachment: .config.gz
Description: application/gzip