From cc9a60c029432b5843724e4f2c57f9f815f7adbb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 21 Mar 2019 12:26:56 +0200 Subject: lib/intel_reg: fix shift undefined behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1<<31 (same as 2<<30) is undefined behaviour in C. When compiling with GCC and UBSan, it gives this error: ../tools/intel_reg_decode.c: In function ‘ivb_debug_port’: ../tools/intel_reg_decode.c:398:3: error: case label does not reduce to an integer constant case PORT_DBG_DRRS_HW_STATE_HIGH: ^~~~ This happens because 1<<31 isn't representable as a signed int. Instead, use an unsigned int. Signed-off-by: Simon Ser Reviewed-by: Petri Latvala --- lib/intel_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/intel_reg.h b/lib/intel_reg.h index f85fb742..069440cb 100644 --- a/lib/intel_reg.h +++ b/lib/intel_reg.h @@ -3383,7 +3383,7 @@ typedef enum { #define PORT_DBG 0x42308 #define PORT_DBG_DRRS_HW_STATE_OFF (0<<30) #define PORT_DBG_DRRS_HW_STATE_LOW (1<<30) -#define PORT_DBG_DRRS_HW_STATE_HIGH (2<<30) +#define PORT_DBG_DRRS_HW_STATE_HIGH (2U<<30) /* RC6 residence counters */ -- cgit v1.2.3