summaryrefslogtreecommitdiffstats
path: root/sys/dev/agp
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2013-11-30 22:17:27 +0000
committereadler <eadler@FreeBSD.org>2013-11-30 22:17:27 +0000
commit44c01df17391f4429ee371e8039ae4fd802c2a8e (patch)
tree050fb3b68519f6ef7d59051550fa29cdd79d6dac /sys/dev/agp
parent5bcb8c5f4293579e5f8aba6f33f85246b7b70e5d (diff)
downloadFreeBSD-src-44c01df17391f4429ee371e8039ae4fd802c2a8e.zip
FreeBSD-src-44c01df17391f4429ee371e8039ae4fd802c2a8e.tar.gz
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
Diffstat (limited to 'sys/dev/agp')
-rw-r--r--sys/dev/agp/agp_i810.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index 414a7a5..725aa99 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -2226,10 +2226,10 @@ agp_i830_chipset_flush(device_t dev)
sc = device_get_softc(dev);
pmap_invalidate_cache();
hic = bus_read_4(sc->sc_res[0], AGP_I830_HIC);
- bus_write_4(sc->sc_res[0], AGP_I830_HIC, hic | (1 << 31));
+ bus_write_4(sc->sc_res[0], AGP_I830_HIC, hic | (1U << 31));
for (i = 0; i < 20000 /* 1 sec */; i++) {
hic = bus_read_4(sc->sc_res[0], AGP_I830_HIC);
- if ((hic & (1 << 31)) == 0)
+ if ((hic & (1U << 31)) == 0)
break;
DELAY(50);
}
OpenPOWER on IntegriCloud