RISC-V: Fix hartid mask handling for hartid 31 and up
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 31 Jan 2022 13:26:20 +0000 (14:26 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 14 Feb 2022 20:27:38 +0000 (12:27 -0800)
commit12f4a665cc3568328728e46c3162873b5b69cd27
treea094e398faaf8bb171303d8753fed50744d1ef36
parent6df2a016c0c8a3d0933ef33dd192ea6606b115e3
RISC-V: Fix hartid mask handling for hartid 31 and up

Jessica reports that using "1 << hartid" causes undefined behavior for
hartid 31 and up.

Fix this by using the BIT() helper instead of an explicit shift.

Reported-by: Jessica Clarke <jrtc27@jrtc27.com>
Fixes: 26fb751ca37846c9 ("RISC-V: Do not use cpumask data structure for hartid bitmap")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/sbi.c