[PATCH 16/21] kcsan: don't use GENMASK()

0 views
Skip to first unread message

Yury Norov (NVIDIA)

unread,
Oct 25, 2025, 12:33:32 PMOct 25
to Linus Walleij, Lee Jones, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, Marco Elver, Dmitry Vyukov, kasa...@googlegroups.com, Yury Norov (NVIDIA)
GENMASK(high, low) notation is confusing. Use BITS(low, high) and
FIRST_BITS() where appropriate.

Signed-off-by: Yury Norov (NVIDIA) <yury....@gmail.com>
---
kernel/kcsan/encoding.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kcsan/encoding.h b/kernel/kcsan/encoding.h
index 170a2bb22f53..3a4cb7b354e3 100644
--- a/kernel/kcsan/encoding.h
+++ b/kernel/kcsan/encoding.h
@@ -44,8 +44,8 @@

/* Bitmasks for the encoded watchpoint access information. */
#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1)
-#define WATCHPOINT_SIZE_MASK GENMASK(BITS_PER_LONG-2, WATCHPOINT_ADDR_BITS)
-#define WATCHPOINT_ADDR_MASK GENMASK(WATCHPOINT_ADDR_BITS-1, 0)
+#define WATCHPOINT_ADDR_MASK FIRST_BITS(WATCHPOINT_ADDR_BITS)
+#define WATCHPOINT_SIZE_MASK BITS(WATCHPOINT_ADDR_BITS, BITS_PER_LONG-2)
static_assert(WATCHPOINT_ADDR_MASK == (1UL << WATCHPOINT_ADDR_BITS) - 1);
static_assert((WATCHPOINT_WRITE_MASK ^ WATCHPOINT_SIZE_MASK ^ WATCHPOINT_ADDR_MASK) == ~0UL);

--
2.43.0

Yury Norov (NVIDIA)

unread,
Oct 25, 2025, 12:41:14 PMOct 25
to Linus Torvalds, Linus Walleij, Nicolas Frattaroli, Marco Elver, Dmitry Vyukov, kasa...@googlegroups.com, linux-...@vger.kernel.org, Yury Norov (NVIDIA), Rasmus Villemoes
Reply all
Reply to author
Forward
0 new messages