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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68c0649d-d9b3-44f4-9a92-7f72c51a5013@suse.cz>
Date: Wed, 11 Jun 2025 19:57:45 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Charlemagne Lasse <charlemagnelasse@...il.com>,
 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>,
 cgroups@...r.kernel.org, linux-mm@...ck.org, linux-rt-devel@...ts.linux.dev
Subject: Re: locking/local_lock, mm: sparse warnings about shadowed variable

On 6/11/25 19:37, Charlemagne Lasse wrote:
> HI,
> 
> when I run `make C=2 mm/mlock.o CHECK="sparse -Wshadow"`, I get a lot of
> 
> ./include/linux/local_lock.h:88:1: warning: symbol 'l' shadows an earlier one
> ./include/linux/local_lock.h:88:1: originally declared here
> 
> after commit
> 
> 51339d99c0131bc0d16d378e9b05bc498d2967e2 is the first bad commit
> commit 51339d99c0131bc0d16d378e9b05bc498d2967e2
> Author: Alexei Starovoitov <ast@...nel.org>
> Date:   2025-04-02 19:55:14 -0700
> 
>    locking/local_lock, mm: replace localtry_ helpers with local_trylock_t type

Looks like __DEFINE_LOCK_GUARD_1() has "_type *l" and __local_lock_acquire()
has "local_lock_t *l;". It can be fixed e.g. like this, although it's
harmless? The _release() part is not necessary, just for symmetry.

diff --git a/include/linux/local_lock_internal.h b/include/linux/local_lock_internal.h
index 8d5ac16a9b17..075338f270d0 100644
--- a/include/linux/local_lock_internal.h
+++ b/include/linux/local_lock_internal.h
@@ -97,17 +97,17 @@ do {                                                                \
 #define __local_lock_acquire(lock)                                     \
        do {                                                            \
                local_trylock_t *tl;                                    \
-               local_lock_t *l;                                        \
+               local_lock_t *ll;                                       \
                                                                        \
-               l = (local_lock_t *)this_cpu_ptr(lock);                 \
-               tl = (local_trylock_t *)l;                              \
+               ll = (local_lock_t *)this_cpu_ptr(lock);                \
+               tl = (local_trylock_t *)ll;                             \
                _Generic((lock),                                        \
                        __percpu local_trylock_t *: ({                  \
                                lockdep_assert(tl->acquired == 0);      \
                                WRITE_ONCE(tl->acquired, 1);            \
                        }),                                             \
                        __percpu local_lock_t *: (void)0);              \
-               local_lock_acquire(l);                                  \
+               local_lock_acquire(ll);                                 \
        } while (0)
 
 #define __local_lock(lock)                                     \
@@ -165,11 +165,11 @@ do {                                                              \
 #define __local_lock_release(lock)                                     \
        do {                                                            \
                local_trylock_t *tl;                                    \
-               local_lock_t *l;                                        \
+               local_lock_t *ll;                                       \
                                                                        \
-               l = (local_lock_t *)this_cpu_ptr(lock);                 \
-               tl = (local_trylock_t *)l;                              \
-               local_lock_release(l);                                  \
+               ll = (local_lock_t *)this_cpu_ptr(lock);                \
+               tl = (local_trylock_t *)ll;                             \
+               local_lock_release(ll);                                 \
                _Generic((lock),                                        \
                        __percpu local_trylock_t *: ({                  \
                                lockdep_assert(tl->acquired == 1);      \


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ