From 3f2fe18965fc5404e4d095a25dcb1be48e4040a5 Mon Sep 17 00:00:00 2001 From: Ryan Salsamendi Date: Tue, 4 Jul 2017 13:14:16 -0700 Subject: southbridge/intel/lynxpoint: Fix undefined behavior Fix undefined behavior found by clang's -Wshift-sign-overflow, grep, and source inspection. Left shifting an int where the right operand is >= the width of the type is undefined. Add UL suffix since it's safe for unsigned types. Change-Id: I10db2566199200ceb3068721cfb35eadb2be1f68 Signed-off-by: Ryan Salsamendi Reviewed-on: https://review.coreboot.org/20464 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/southbridge/intel/lynxpoint/lp_gpio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/southbridge/intel/lynxpoint/lp_gpio.h') diff --git a/src/southbridge/intel/lynxpoint/lp_gpio.h b/src/southbridge/intel/lynxpoint/lp_gpio.h index c35e770441..64e9c31931 100644 --- a/src/southbridge/intel/lynxpoint/lp_gpio.h +++ b/src/southbridge/intel/lynxpoint/lp_gpio.h @@ -51,9 +51,9 @@ #define GPI_LEVEL (1 << 30) #define GPO_LEVEL_SHIFT 31 -#define GPO_LEVEL_MASK (1 << GPO_LEVEL_SHIFT) -#define GPO_LEVEL_LOW (0 << GPO_LEVEL_SHIFT) -#define GPO_LEVEL_HIGH (1 << GPO_LEVEL_SHIFT) +#define GPO_LEVEL_MASK (1UL << GPO_LEVEL_SHIFT) +#define GPO_LEVEL_LOW (0UL << GPO_LEVEL_SHIFT) +#define GPO_LEVEL_HIGH (1UL << GPO_LEVEL_SHIFT) /* conf1 */ -- cgit v1.2.3