Skip to contentSkip to conversation

drm/amdkfd: Fix the shift-out-of-bounds warning

PATCH New Ma Jun 1 participant 1 message Jan 11, 2024 AMD KFD

lore
Share & tools
lore

Ma Jun

author
#0 lore raw

PATCH v2 1/1 drm/amdkfd: Fix the shift-out-of-bounds warning

There is shift-out-of-bounds warning following if ecode=0.
"shift exponent 4294967295 is too large for 64-bit type 'long long unsigned int'"

---
 include/uapi/linux/kfd_ioctl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/kfd_ioctl.h +1 -1
index 2aa88afe305b..90b04c0401fc 100644
@@ -1004,7 +1004,7 @@ enum kfd_dbg_trap_exception_code {
 };
 
 /* Mask generated by ecode in kfd_dbg_trap_exception_code */
-#define KFD_EC_MASK(ecode)	(1ULL << (ecode - 1))
+#define KFD_EC_MASK(ecode)	((ecode) ? 1ULL << (ecode - 1) : 0ULL)
 
 /* Masks for exception code type checks below */
 #define KFD_EC_MASK_QUEUE	(KFD_EC_MASK(EC_QUEUE_WAVE_ABORT) |	\
Signature · 1 line
2.34.1