net/ipv4/tcp_cong.c:228:24: sparse: sparse: incorrect type in argument 3 (different address spaces)

From: kernel test robot
Date: Sun Aug 16 2020 - 05:35:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b6c093e21d36bede0fd88fd0aeb3b03647260e4
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 8 weeks ago
config: s390-randconfig-s032-20200811 (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.2-168-g9554805c-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=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/tcp_cong.c:228:24: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct tcp_congestion_ops const [noderef] __rcu * @@ got struct tcp_congestion_ops *[assigned] ca @@
>> net/ipv4/tcp_cong.c:228:24: sparse: expected struct tcp_congestion_ops const [noderef] __rcu *
net/ipv4/tcp_cong.c:228:24: sparse: got struct tcp_congestion_ops *[assigned] ca
net/ipv4/tcp_cong.c:228:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct tcp_congestion_ops const *prev @@ got struct tcp_congestion_ops const [noderef] __rcu *[assigned] __old @@
net/ipv4/tcp_cong.c:228:22: sparse: expected struct tcp_congestion_ops const *prev
net/ipv4/tcp_cong.c:228:22: sparse: got struct tcp_congestion_ops const [noderef] __rcu *[assigned] __old

vim +228 net/ipv4/tcp_cong.c

317a76f9a44b437 Stephen Hemminger 2005-06-23 213
317a76f9a44b437 Stephen Hemminger 2005-06-23 214 /* Used by sysctl to change default congestion control */
6670e152447732b Stephen Hemminger 2017-11-14 215 int tcp_set_default_congestion_control(struct net *net, const char *name)
317a76f9a44b437 Stephen Hemminger 2005-06-23 216 {
317a76f9a44b437 Stephen Hemminger 2005-06-23 217 struct tcp_congestion_ops *ca;
6670e152447732b Stephen Hemminger 2017-11-14 218 const struct tcp_congestion_ops *prev;
6670e152447732b Stephen Hemminger 2017-11-14 219 int ret;
317a76f9a44b437 Stephen Hemminger 2005-06-23 220
6670e152447732b Stephen Hemminger 2017-11-14 221 rcu_read_lock();
6670e152447732b Stephen Hemminger 2017-11-14 222 ca = tcp_ca_find_autoload(net, name);
6670e152447732b Stephen Hemminger 2017-11-14 223 if (!ca) {
6670e152447732b Stephen Hemminger 2017-11-14 224 ret = -ENOENT;
0baf26b0fcd74bb Martin KaFai Lau 2020-01-08 225 } else if (!bpf_try_module_get(ca, ca->owner)) {
6670e152447732b Stephen Hemminger 2017-11-14 226 ret = -EBUSY;
6670e152447732b Stephen Hemminger 2017-11-14 227 } else {
6670e152447732b Stephen Hemminger 2017-11-14 @228 prev = xchg(&net->ipv4.tcp_congestion_control, ca);
6670e152447732b Stephen Hemminger 2017-11-14 229 if (prev)
0baf26b0fcd74bb Martin KaFai Lau 2020-01-08 230 bpf_module_put(prev, prev->owner);
317a76f9a44b437 Stephen Hemminger 2005-06-23 231
6670e152447732b Stephen Hemminger 2017-11-14 232 ca->flags |= TCP_CONG_NON_RESTRICTED;
317a76f9a44b437 Stephen Hemminger 2005-06-23 233 ret = 0;
317a76f9a44b437 Stephen Hemminger 2005-06-23 234 }
6670e152447732b Stephen Hemminger 2017-11-14 235 rcu_read_unlock();
317a76f9a44b437 Stephen Hemminger 2005-06-23 236
317a76f9a44b437 Stephen Hemminger 2005-06-23 237 return ret;
317a76f9a44b437 Stephen Hemminger 2005-06-23 238 }
317a76f9a44b437 Stephen Hemminger 2005-06-23 239

:::::: The code at line 228 was first introduced by commit
:::::: 6670e152447732ba90626f36dfc015a13fbf150e tcp: Namespace-ify sysctl_tcp_default_congestion_control

:::::: TO: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
:::::: 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