[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQG6wTDy7Bnf4XDI@google.com>
Date: Wed, 29 Oct 2025 14:57:05 +0800
From: Kuan-Wei Chiu <visitorckw@...il.com>
To: rafael@...nel.org, daniel.lezcano@...aro.org
Cc: rui.zhang@...el.com, lukasz.luba@....com, jacob.jun.pan@...ux.intel.com,
	jserv@...s.ncku.edu.tw, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tmon: Fix undefined behavior in left shift
On Mon, Sep 01, 2025 at 10:47:56PM +0800, Kuan-Wei Chiu wrote:
> Using 1 << j when j reaches 31 triggers undefined behavior because
> the constant 1 is of type int, and shifting it left by 31 exceeds
> the range of signed int. UBSAN reports:
> 
> tmon.c:174:54: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
> 
> According to the C11 standard:
> 
> "If E1 has a signed type and E1 x 2^E2 is not representable in the
> result type, the behavior is undefined."
> 
> Fix this by using 1U << j, ensuring the shift is performed on an
> unsigned type where all 32 bits are representable.
> 
> Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
> Signed-off-by: Kuan-Wei Chiu <visitorckw@...il.com>
I know maintainers are busy people, so I usually try to avoid sending
ping messages. However, this patch was submitted about two months ago
and hasn't received any feedback yet. It looks like it might have
somehow got lost?
Regards,
Kuan-Wei
Powered by blists - more mailing lists
 
