[PATCH 20/21] fortify-string: don't use GENMASK()

Yury Norov (NVIDIA)
2025-10-25T16:33:38Z

GENMASK(high, low) notation is confusing. BITS(low, high) is more
appropriate.

Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
include/linux/fortify-string.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index b3b53f8c1b28..0c95cdcca736 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -11,9 +11,9 @@
#define __RENAME(x) __asm__(#x)

#define FORTIFY_REASON_DIR(r) FIELD_GET(BIT(0), r)
-#define FORTIFY_REASON_FUNC(r) FIELD_GET(GENMASK(7, 1), r)
+#define FORTIFY_REASON_FUNC(r) FIELD_GET(BITS(1, 7), r)
#define FORTIFY_REASON(func, write) (FIELD_PREP(BIT(0), write) | \
- FIELD_PREP(GENMASK(7, 1), func))
+ FIELD_PREP(BITS(1, 7), func))

/* Overridden by KUnit tests. */
#ifndef fortify_panic
--
2.43.0