Re: [PATCH] x86/cpu: replacing the open-coded shift with BIT(x)

From: cuigaosheng
Date: Tue Nov 01 2022 - 07:33:08 EST


Same as to the other case; UBSAN is broken garbage, stop quoting it.

I have made patch v2 and submitted it, removed the UBSAN warning calltrace,
and merged the patch "x86/cpu: fix undefined behavior in bit shift for intel_detect_tlb"
with it. Thanks!

On 2022/11/1 16:48, Peter Zijlstra wrote:
On Tue, Nov 01, 2022 at 02:09:45PM +0800, Gaosheng Cui wrote:
Replace the open-coded shift with BIT(x) for x86_power to make the
code a bit more self-documenting, and we will get a UBSAN issue in
arch/x86/kernel/cpu/proc.c, fix it.

The UBSAN warning calltrace like below:

UBSAN: shift-out-of-bounds in arch/x86/kernel/cpu/proc.c:138:25
left shift of 1 by 31 places cannot be represented in type 'int'
Same as to the other case; UBSAN is broken garbage, stop quoting it.

.