[PATCH] tools intel-speed-select: Fix signed shift UB in BIT() macro

From: liujing

Date: Thu Sep 03 2026 - 04:36:14 EST


From: Liu Jing <liujing@xxxxxxxxxxxxxxxxxxxx>

The BIT() macro is defined as `(1 << (x))` with a signed integer 1.
When x >= 31, this causes signed integer overflow which is undefined
behavior in C. This macro is used with BIT(31) in isst-core.c and
isst-core-mbox.c.

Fix it by using `1U` instead of `1` to perform an unsigned shift,
matching the kernel's own BIT() definition which uses unsigned.

Signed-off-by: Liu Jing <liujing@xxxxxxxxxxxxxxxxxxxx>
---
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -30,7 +30,7 @@

#include <linux/isst_if.h>

-#define BIT(x) (1 << (x))
+#define BIT(x) (1U << (x))
#define BIT_ULL(nr) (1ULL << (nr))
#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))
#define GENMASK_ULL(h, l) \