lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFGhKbwP9e6yWM615FGuq0=eX-57E-f813MMdXZ98D4_+0TveQ@mail.gmail.com>
Date: Thu, 12 Jun 2025 09:03:27 +0200
From: Charlemagne Lasse <charlemagnelasse@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Vlastimil Babka <vbabka@...e.cz>, Johannes Weiner <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>, 
	Roman Gushchin <roman.gushchin@...ux.dev>, Shakeel Butt <shakeel.butt@...ux.dev>, 
	Muchun Song <muchun.song@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>, 
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Clark Williams <clrkwllms@...nel.org>, 
	Steven Rostedt <rostedt@...dmis.org>, Alexei Starovoitov <ast@...nel.org>, 
	Thomas Gleixner <tglx@...utronix.de>, Jakub Kicinski <kuba@...nel.org>, 
	"Peter Zijlstra (Intel)" <peterz@...radead.org>, Davidlohr Bueso <dave@...olabs.net>, 
	LKML <linux-kernel@...r.kernel.org>, 
	"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>, linux-mm <linux-mm@...ck.org>, 
	linux-rt-devel@...ts.linux.dev
Subject: Re: locking/local_lock, mm: sparse warnings about shadowed variable

Am Mi., 11. Juni 2025 um 20:20 Uhr schrieb Alexei Starovoitov
<alexei.starovoitov@...il.com>:
> I wouldn't bother messing with the code because of sparse.
> Compilers don't warn here.

Actually, they do:

$ make W=2 mm/mlock.o
[...]
In file included from ./include/linux/preempt.h:11,
                from ./include/linux/spinlock.h:56,
                from ./include/linux/wait.h:9,
                from ./include/linux/wait_bit.h:8,
                from ./include/linux/fs.h:7,
                from ./include/linux/mman.h:5,
                from mm/mlock.c:10:
./include/linux/local_lock.h: In function
‘class_local_lock_irqsave_constructor’:
./include/linux/local_lock_internal.h:100:31: warning: declaration of
‘l’ shadows a parameter [-Wshadow]
 100 |                 local_lock_t *l;                                        \
     |                               ^
./include/linux/cleanup.h:394:9: note: in definition of macro
‘__DEFINE_LOCK_GUARD_1’
 394 |         _lock;                                                          \
     |         ^~~~~
./include/linux/local_lock.h:88:1: note: in expansion of macro
‘DEFINE_LOCK_GUARD_1’
  88 | DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
     | ^~~~~~~~~~~~~~~~~~~
./include/linux/local_lock_internal.h:128:17: note: in expansion of
macro ‘__local_lock_acquire’
 128 |                 __local_lock_acquire(lock);                     \
     |                 ^~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:31:9: note: in expansion of macro
‘__local_lock_irqsave’
  31 |         __local_lock_irqsave(lock, flags)
     |         ^~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:89:21: note: in expansion of macro
‘local_lock_irqsave’
  89 |                     local_lock_irqsave(_T->lock, _T->flags),
     |                     ^~~~~~~~~~~~~~~~~~
./include/linux/cleanup.h:391:68: note: shadowed declaration is here
 391 | static inline class_##_name##_t class_##_name##_constructor(_type *l)   \
./include/linux/cleanup.h:410:1: note: in expansion of macro
‘__DEFINE_LOCK_GUARD_1’
 410 | __DEFINE_LOCK_GUARD_1(_name, _type, _lock)
     | ^~~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:88:1: note: in expansion of macro
‘DEFINE_LOCK_GUARD_1’
  88 | DEFINE_LOCK_GUARD_1


$ gcc --version
gcc (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ