From: Min-Hsun Chang <chmh0624@gmail.com>
To: arnd@arndb.de
Cc: msalter@redhat.com, akpm@linux-foundation.org,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Min-Hsun Chang <chmh0624@gmail.com>
Subject: [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr)
Date: Sat, 7 Mar 2026 17:21:19 +0800 [thread overview]
Message-ID: <20260307092119.20733-1-chmh0624@gmail.com> (raw)
The macro __set_fixmap_offset() uses a hardcoded identifier ________addr,
which can lead to variable name shadowing if a caller happens to use the
same name in its scope.
Following the pattern in commit 44238e82670e ("rcu: Replace ________p1 and
_________p1 with __UNIQUE_ID(rcu)") and commit 589a9785ee3a ("min/max:
remove sparse warnings when they're nested"), replace the hardcoded
identifier with __UNIQUE_ID(addr).
Since __UNIQUE_ID() must be expanded once to remain consistent across
declaration, assignment, and return within the statement expression,
introduce a nested helper macro ___set_fixmap_offset.
Signed-off-by: Min-Hsun Chang <chmh0624@gmail.com>
---
include/asm-generic/fixmap.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
index 29cab7947980..2d1e9a2c6a3b 100644
--- a/include/asm-generic/fixmap.h
+++ b/include/asm-generic/fixmap.h
@@ -16,6 +16,7 @@
#define __ASM_GENERIC_FIXMAP_H
#include <linux/bug.h>
+#include <linux/compiler.h>
#include <linux/mm_types.h>
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
@@ -71,14 +72,17 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
#endif
/* Return a pointer with offset calculated */
-#define __set_fixmap_offset(idx, phys, flags) \
-({ \
- unsigned long ________addr; \
- __set_fixmap(idx, phys, flags); \
- ________addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \
- ________addr; \
+#define ___set_fixmap_offset(idx, phys, flags, uniq) \
+({ \
+ unsigned long uniq; \
+ __set_fixmap(idx, phys, flags); \
+ uniq = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \
+ uniq; \
})
+#define __set_fixmap_offset(idx, phys, flags) \
+ ___set_fixmap_offset(idx, phys, flags, __UNIQUE_ID(addr))
+
#define set_fixmap_offset(idx, phys) \
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL)
--
2.50.1
next reply other threads:[~2026-03-07 9:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 9:21 Min-Hsun Chang [this message]
2026-03-22 13:20 ` [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr) Min-Hsun Chang
2026-03-22 14:40 ` David Laight
2026-03-23 6:02 ` [PATCH v2] asm-generic: convert __set_fixmap_offset() to static inline Min-Hsun Chang
2026-04-25 20:57 ` [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr) Andrew Morton
2026-04-25 22:01 ` David Laight
2026-04-25 22:12 ` Andrew Morton
2026-04-26 10:49 ` David Laight
2026-04-26 11:09 ` Andrew Morton
2026-04-26 17:34 ` David Laight
2026-04-26 18:09 ` Andrew Morton
2026-04-26 21:43 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260307092119.20733-1-chmh0624@gmail.com \
--to=chmh0624@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=msalter@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.