From ec294fd7f5fc5de11ed889d6c2d701f918d1ecfb Mon Sep 17 00:00:00 2001 From: eadler Date: Tue, 4 Feb 2014 03:36:42 +0000 Subject: MFC r258779,r258780,r258787,r258822: Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this shifts into the sign bit. Instead use (1U << 31) which gets the expected result. Similar to the (1 << 31) case it is not defined to do (2 << 30). This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. --- sys/dev/wpi/if_wpireg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev/wpi') diff --git a/sys/dev/wpi/if_wpireg.h b/sys/dev/wpi/if_wpireg.h index 2ccc21f..df71b3d 100644 --- a/sys/dev/wpi/if_wpireg.h +++ b/sys/dev/wpi/if_wpireg.h @@ -143,7 +143,7 @@ /* possible flags for register WPI_UC_CTL */ #define WPI_UC_ENABLE (1 << 30) -#define WPI_UC_RUN (1 << 31) +#define WPI_UC_RUN (1U << 31) /* possible flags for register WPI_INTR_CSR */ #define WPI_ALIVE_INTR (1 << 0) @@ -151,7 +151,7 @@ #define WPI_SW_ERROR (1 << 25) #define WPI_TX_INTR (1 << 27) #define WPI_HW_ERROR (1 << 29) -#define WPI_RX_INTR (1 << 31) +#define WPI_RX_INTR (1U << 31) #define WPI_INTR_MASK \ (WPI_SW_ERROR | WPI_HW_ERROR | WPI_TX_INTR | WPI_RX_INTR | \ -- cgit v1.1