Skip to contentSkip to conversation

net/l2tp/l2tp_core.c:1298:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

PATCH kernel test robot 1 participant 1 message Jun 21, 2024 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   f76698bd9a8ca01d3581236082d786e9a6b72bb7
commit: d18d3f0a24fc4a3513495892ab1a3753628b341b [7577/7797] l2tp: replace hlist with simple list for per-tunnel session list
config: i386-randconfig-062-20240622 (https://download.01.org/0day-ci/archive/20240622/[email protected]/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240622/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> net/l2tp/l2tp_core.c:1298:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct list_head const *list @@     got struct list_head [noderef] __rcu *pos @@
   net/l2tp/l2tp_core.c:1298:9: sparse:     expected struct list_head const *list
   net/l2tp/l2tp_core.c:1298:9: sparse:     got struct list_head [noderef] __rcu *pos
>> net/l2tp/l2tp_core.c:1298:9: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct list_head [noderef] __rcu *pos @@     got struct list_head *next @@
   net/l2tp/l2tp_core.c:1298:9: sparse:     expected struct list_head [noderef] __rcu *pos
   net/l2tp/l2tp_core.c:1298:9: sparse:     got struct list_head *next
>> net/l2tp/l2tp_core.c:1299:27: sparse: sparse: cast removes address space '__rcu' of expression
>> net/l2tp/l2tp_core.c:1298:9: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct list_head [noderef] __rcu *pos @@     got struct list_head *[assigned] tmp @@
   net/l2tp/l2tp_core.c:1298:9: sparse:     expected struct list_head [noderef] __rcu *pos
   net/l2tp/l2tp_core.c:1298:9: sparse:     got struct list_head *[assigned] tmp
   net/l2tp/l2tp_core.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/umh.h, include/linux/kmod.h, ...):
   include/linux/page-flags.h:240:46: sparse: sparse: self-comparison always evaluates to false
   include/linux/page-flags.h:240:46: sparse: sparse: self-comparison always evaluates to false
>> net/l2tp/l2tp_core.c:1298:9: sparse: sparse: dereference of noderef expression
>> net/l2tp/l2tp_core.c:1298:9: sparse: sparse: dereference of noderef expression

vim +1298 net/l2tp/l2tp_core.c

1287
1288 /* When the tunnel is closed, all the attached sessions need to go too.
1289 */
1290 static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel)
1291 {
1292 struct l2tp_session *session;
1293 struct list_head __rcu *pos;
1294 struct list_head *tmp;
1295
1296 spin_lock_bh(&tunnel->list_lock);
1297 tunnel->acpt_newsess = false;

> 1298		list_for_each_safe(pos, tmp, &tunnel->session_list) {
> 1299			session = list_entry(pos, struct l2tp_session, list);

1300 list_del_init(&session->list);
1301 spin_unlock_bh(&tunnel->list_lock);
1302 l2tp_session_delete(session);
1303 spin_lock_bh(&tunnel->list_lock);
1304 }
1305 spin_unlock_bh(&tunnel->list_lock);
1306 }
1307

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