From: Liu Jing <liujing@cmss.chinamobile.com>
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@cmss.chinamobile.com>
---
--- 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) \
On Thu, 2026-09-03 at 16:28 +0800, liujing wrote: > From: Liu Jing <liujing@cmss.chinamobile.com> > > 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@cmss.chinamobile.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/spandruvada/linux.git/log/?h=for-sst-v7.4.rc1 Thanks, Srinivas > --- > --- 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) \ > > >
© 2016 - 2026 Red Hat, Inc.