[PATCH 2/3] hwf-x86: fix UBSAN warning

Jussi Kivilinna jussi.kivilinna at iki.fi
Sat Jul 16 18:00:04 CEST 2022


* src/hwf-x86.c (detect_x86_gnuc): Change `(1 << 31)` to `(1U << 31)`
to fix undefined behaviour.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 src/hwf-x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hwf-x86.c b/src/hwf-x86.c
index 20420798..b440827e 100644
--- a/src/hwf-x86.c
+++ b/src/hwf-x86.c
@@ -431,7 +431,7 @@ detect_x86_gnuc (void)
 	  && (features & (1 << 21))
 	  && (features & (1 << 28))
 	  && (features & (1 << 30))
-	  && (features & (1 << 31))
+	  && (features & (1U << 31))
 	  && (features2 & (1 << 1))
 	  && (features2 & (1 << 6))
 	  && (features2 & (1 << 11))
-- 
2.34.1




More information about the Gcrypt-devel mailing list