diff options
author | Eitan Adler <eadler@FreeBSD.org> | 2013-11-30 22:17:27 +0000 |
---|---|---|
committer | Eitan Adler <eadler@FreeBSD.org> | 2013-11-30 22:17:27 +0000 |
commit | 7a22215c5346c9009d1dfa4d3c118ff99f89d184 (patch) | |
tree | 050fb3b68519f6ef7d59051550fa29cdd79d6dac /sys/i386 | |
parent | c8aef31d309ac3f874c461619248fee9c1d74c2f (diff) | |
download | src-7a22215c5346c9009d1dfa4d3c118ff99f89d184.tar.gz src-7a22215c5346c9009d1dfa4d3c118ff99f89d184.zip |
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.
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.
Discussed with: -arch, rdivacky
Reviewed by: cperciva
Notes
Notes:
svn path=/head/; revision=258780
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/pci/pci_cfgreg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index bddaaa836c7d..cce4981d9c9d 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -306,7 +306,7 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes) switch (cfgmech) { case CFGMECH_PCIE: case CFGMECH_1: - outl(CONF1_ADDR_PORT, (1 << 31) + outl(CONF1_ADDR_PORT, (1U << 31) | (bus << 16) | (slot << 11) | (func << 8) | (reg & ~0x03)); dataport = CONF1_DATA_PORT + (reg & 0x03); |