Skip to contentSkip to conversation

riscv: hwprobe: fix invalid sign extension for RISCV_HWPROBE_EXT_ZVFHMIN

PATCH Applied Clément Léger 3 participants 3 messages Apr 9, 2024 – Apr 25, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: hwprobe: fix invalid sign extension for RISCV_HWPROBE_EXT_ZVFHMIN

The current definition yields a negative 32bits signed value which result in a mask with is obviously incorrect. Replace it by using a 1ULL bit shift value to obtain a single set bit mask.

Fixes 5dadda5e6a59 ("riscv: hwprobe: export Zvfh[min] ISA extensions")
---
 arch/riscv/include/uapi/asm/hwprobe.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/uapi/asm/hwprobe.h +1 -1
index 9f2a8e3ff204..2902f68dc913 100644
@@ -54,7 +54,7 @@ struct riscv_hwprobe {
 #define		RISCV_HWPROBE_EXT_ZFHMIN	(1 << 28)
 #define		RISCV_HWPROBE_EXT_ZIHINTNTL	(1 << 29)
 #define		RISCV_HWPROBE_EXT_ZVFH		(1 << 30)
-#define		RISCV_HWPROBE_EXT_ZVFHMIN	(1 << 31)
+#define		RISCV_HWPROBE_EXT_ZVFHMIN	(1ULL << 31)
 #define		RISCV_HWPROBE_EXT_ZFA		(1ULL << 32)
 #define		RISCV_HWPROBE_EXT_ZTSO		(1ULL << 33)
 #define		RISCV_HWPROBE_EXT_ZACAS		(1ULL << 34)
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Clément,

Quoted 15 lines · Clément Léger

The current definition yields a negative 32bits signed value which result in a mask with is obviously incorrect. Replace it by using a 1ULL bit shift value to obtain a single set bit mask.

Fixes 5dadda5e6a59 ("riscv: hwprobe: export Zvfh[min] ISA extensions")
---
  arch/riscv/include/uapi/asm/hwprobe.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/uapi/asm/hwprobe.h +0 -0
index 9f2a8e3ff204..2902f68dc913 100644

arch/riscv/include/uapi/asm/hwprobe.h struct riscv_hwprobe { · line 60

Quoted 8 lines
arch/riscv/include/uapi/asm/hwprobe.h +1 -1
@@ -54,7 +54,7 @@ struct riscv_hwprobe {
  #define		RISCV_HWPROBE_EXT_ZFHMIN	(1 << 28)
  #define		RISCV_HWPROBE_EXT_ZIHINTNTL	(1 << 29)
  #define		RISCV_HWPROBE_EXT_ZVFH		(1 << 30)
-#define		RISCV_HWPROBE_EXT_ZVFHMIN	(1 << 31)
+#define		RISCV_HWPROBE_EXT_ZVFHMIN	(1ULL << 31)
  #define		RISCV_HWPROBE_EXT_ZFA		(1ULL << 32)
  #define		RISCV_HWPROBE_EXT_ZTSO		(1ULL << 33)
  #define		RISCV_HWPROBE_EXT_ZACAS		(1ULL << 34)

Thanks,

Alex

#2 lore raw
In reply to Clément Léger
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Tue, 9 Apr 2024 16:38:37 +0200 you wrote:

The current definition yields a negative 32bits signed value which result in a mask with is obviously incorrect. Replace it by using a 1ULL bit shift value to obtain a single set bit mask.

Fixes 5dadda5e6a59 ("riscv: hwprobe: export Zvfh[min] ISA extensions")

[...]

Here is the summary with links:
- [riscv/fixes] riscv: hwprobe: fix invalid sign extension for RISCV_HWPROBE_EXT_ZVFHMIN

    https://git.kernel.org/riscv/c/5ea6764d9095

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html