include/linux/rculist.h:524:9: sparse: sparse: incompatible types in comparison expression (different address spaces):

From: kernel test robot
Date: Sun Nov 12 2023 - 11:46:39 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1b907d0507354b74a4f2c286380cd6059af79248
commit: 6b03d1304a32dc8450c7516000a0fe07bef7c446 proc: Ensure we see the exit of each process tid exactly once
date: 3 years, 7 months ago
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20231113/202311130034.cLZT80OM-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231113/202311130034.cLZT80OM-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311130034.cLZT80OM-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/pid.c:377:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/pid.c:377:9: sparse: struct pid [noderef] <asn:4> *
kernel/pid.c:377:9: sparse: struct pid *
kernel/pid.c:378:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/pid.c:378:9: sparse: struct pid [noderef] <asn:4> *
kernel/pid.c:378:9: sparse: struct pid *
kernel/pid.c:440:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/pid.c:440:23: sparse: struct pid [noderef] <asn:4> *
kernel/pid.c:440:23: sparse: struct pid *
kernel/pid.c:499:32: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/pid.c:499:32: sparse: struct pid [noderef] <asn:4> *
kernel/pid.c:499:32: sparse: struct pid *
kernel/pid.c: note: in included file (through include/linux/pid.h, include/linux/sched.h, include/linux/mm.h):
>> include/linux/rculist.h:524:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/rculist.h:524:9: sparse: struct hlist_node [noderef] <asn:4> *
>> include/linux/rculist.h:524:9: sparse: struct hlist_node *
include/linux/rculist.h:525:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/rculist.h:525:9: sparse: struct hlist_node [noderef] <asn:4> *
include/linux/rculist.h:525:9: sparse: struct hlist_node *

vim +524 include/linux/rculist.h

82524746c27fa4 Franck Bui-Huu 2008-05-12 508
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 509 /**
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 510 * hlists_swap_heads_rcu - swap the lists the hlist heads point to
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 511 * @left: The hlist head on the left
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 512 * @right: The hlist head on the right
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 513 *
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 514 * The lists start out as [@left ][node1 ... ] and
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 515 [@right ][node2 ... ]
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 516 * The lists end up as [@left ][node2 ... ]
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 517 * [@right ][node1 ... ]
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 518 */
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 519 static inline void hlists_swap_heads_rcu(struct hlist_head *left, struct hlist_head *right)
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 520 {
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 521 struct hlist_node *node1 = left->first;
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 522 struct hlist_node *node2 = right->first;
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 523
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 @524 rcu_assign_pointer(left->first, node2);
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 525 rcu_assign_pointer(right->first, node1);
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 526 WRITE_ONCE(node2->pprev, &left->first);
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 527 WRITE_ONCE(node1->pprev, &right->first);
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 528 }
35fc0e3b0bd5be Eric W. Biederman 2020-04-24 529

:::::: The code at line 524 was first introduced by commit
:::::: 35fc0e3b0bd5be3b059e53ae90c4536ee4922330 rculist: Add hlists_swap_heads_rcu

:::::: TO: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
:::::: CC: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki