diff options
author | eadler <eadler@FreeBSD.org> | 2014-02-04 03:36:42 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2014-02-04 03:36:42 +0000 |
commit | ec294fd7f5fc5de11ed889d6c2d701f918d1ecfb (patch) | |
tree | 7e76e370b9406b0383b17bd343084addb4ad6a25 /sys/dev/hwpmc/hwpmc_piv.h | |
parent | d374d7f398b846dc59d8a5ec3c7bfb318cf880af (diff) | |
download | FreeBSD-src-ec294fd7f5fc5de11ed889d6c2d701f918d1ecfb.zip FreeBSD-src-ec294fd7f5fc5de11ed889d6c2d701f918d1ecfb.tar.gz |
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.
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_piv.h')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_piv.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/hwpmc/hwpmc_piv.h b/sys/dev/hwpmc/hwpmc_piv.h index ebde966..4faeadd 100644 --- a/sys/dev/hwpmc/hwpmc_piv.h +++ b/sys/dev/hwpmc/hwpmc_piv.h @@ -39,7 +39,7 @@ #define P4_MAX_ESCR_PER_EVENT 2 #define P4_MAX_PMC_PER_ESCR 3 -#define P4_CCCR_OVF (1 << 31) +#define P4_CCCR_OVF (1U << 31) #define P4_CCCR_CASCADE (1 << 30) #define P4_CCCR_OVF_PMI_T1 (1 << 27) #define P4_CCCR_OVF_PMI_T0 (1 << 26) |