mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: liujing <liujing@cmss.chinamobile.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools intel-speed-select: Fix signed shift UB in BIT() macro
Date: Wed, 09 Sep 2026 18:06:34 -0700	[thread overview]
Message-ID: <90220ff3830673fafbfba39b84e91c06d8afa712.camel@linux.intel.com> (raw)
In-Reply-To: <20260903082817.5203-1-liujing@cmss.chinamobile.com>

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)                                                      \
> 
> 
> 

      reply	other threads:[~2026-09-10  1:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  8:28 liujing
2026-09-10  1:06 ` srinivas pandruvada [this message]

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=90220ff3830673fafbfba39b84e91c06d8afa712.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®