aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorRobert Noland <rnoland@FreeBSD.org>2009-03-20 18:30:20 +0000
committerRobert Noland <rnoland@FreeBSD.org>2009-03-20 18:30:20 +0000
commit45d0290a5d9eb0762e5494a0ce7002427d167ff4 (patch)
tree0de2adce2fd530a8d132c3e844d042e636dfafa9 /sys/dev
parent1a604cfa07381c3cdf2c3d89ab2e25244845722c (diff)
downloadsrc-45d0290a5d9eb0762e5494a0ce7002427d167ff4.tar.gz
src-45d0290a5d9eb0762e5494a0ce7002427d167ff4.zip
vm_offset_t is unsigned and therefore can not be negative.
Avoid unnessecary compares. Found with: Coverity Prevent(tm) CID: 2362,4215,4214,4209,4208,2363,4211,4210,4213,4212 MFC after: 3 days
Notes
Notes: svn path=/head/; revision=190169
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/agp/agp.c2
-rw-r--r--sys/dev/agp/agp_amd64.c4
-rw-r--r--sys/dev/agp/agp_i810.c6
-rw-r--r--sys/dev/agp/agp_intel.c4
-rw-r--r--sys/dev/agp/agp_via.c4
5 files changed, 10 insertions, 10 deletions
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index af34d147e88e..560d3d8d60f3 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -532,7 +532,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
int error;
/* Do some sanity checks first. */
- if (offset < 0 || (offset & (AGP_PAGE_SIZE - 1)) != 0 ||
+ if ((offset & (AGP_PAGE_SIZE - 1)) != 0 ||
offset + mem->am_size > AGP_GET_APERTURE(dev)) {
device_printf(dev, "binding memory at bad offset %#x\n",
(int)offset);
diff --git a/sys/dev/agp/agp_amd64.c b/sys/dev/agp/agp_amd64.c
index c68847ab7182..e2bfa6764541 100644
--- a/sys/dev/agp/agp_amd64.c
+++ b/sys/dev/agp/agp_amd64.c
@@ -337,7 +337,7 @@ agp_amd64_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
{
struct agp_amd64_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return (EINVAL);
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] =
@@ -351,7 +351,7 @@ agp_amd64_unbind_page(device_t dev, vm_offset_t offset)
{
struct agp_amd64_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return (EINVAL);
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index 48cf17124c51..891bfff89da1 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -840,7 +840,7 @@ agp_i810_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
{
struct agp_i810_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
device_printf(dev, "failed: offset is 0x%08jx, shift is %d, entries is %d\n", (intmax_t)offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries);
return EINVAL;
}
@@ -862,7 +862,7 @@ agp_i810_unbind_page(device_t dev, vm_offset_t offset)
{
struct agp_i810_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return EINVAL;
if ( sc->chiptype != CHIP_I810 ) {
@@ -1016,7 +1016,7 @@ agp_i810_bind_memory(device_t dev, struct agp_memory *mem,
vm_offset_t i;
/* Do some sanity checks first. */
- if (offset < 0 || (offset & (AGP_PAGE_SIZE - 1)) != 0 ||
+ if ((offset & (AGP_PAGE_SIZE - 1)) != 0 ||
offset + mem->am_size > AGP_GET_APERTURE(dev)) {
device_printf(dev, "binding memory at bad offset %#x\n",
(int)offset);
diff --git a/sys/dev/agp/agp_intel.c b/sys/dev/agp/agp_intel.c
index 3463d826d14c..ac10c8ee1be7 100644
--- a/sys/dev/agp/agp_intel.c
+++ b/sys/dev/agp/agp_intel.c
@@ -371,7 +371,7 @@ agp_intel_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return (EINVAL);
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 0x17;
@@ -385,7 +385,7 @@ agp_intel_unbind_page(device_t dev, vm_offset_t offset)
sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return (EINVAL);
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
diff --git a/sys/dev/agp/agp_via.c b/sys/dev/agp/agp_via.c
index 2873692274aa..76ce382488bd 100644
--- a/sys/dev/agp/agp_via.c
+++ b/sys/dev/agp/agp_via.c
@@ -362,7 +362,7 @@ agp_via_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
{
struct agp_via_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return EINVAL;
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
@@ -374,7 +374,7 @@ agp_via_unbind_page(device_t dev, vm_offset_t offset)
{
struct agp_via_softc *sc = device_get_softc(dev);
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
+ if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
return EINVAL;
sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;