summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_rman.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-04-12 23:02:21 +0000
committerimp <imp@FreeBSD.org>2004-04-12 23:02:21 +0000
commitb44936146606e2cb1af6a271e881e5a5f591172b (patch)
treefd7a0874c0155cdc83ca24429a1cc54b7cbc61fd /sys/kern/subr_rman.c
parent200ffbe56da1ce63104bfca18c97d7caf4aecb51 (diff)
downloadFreeBSD-src-b44936146606e2cb1af6a271e881e5a5f591172b.zip
FreeBSD-src-b44936146606e2cb1af6a271e881e5a5f591172b.tar.gz
Fix off by one error, twice.
Submitted by: Carlos Velasco (first one), jhb (second one)
Diffstat (limited to 'sys/kern/subr_rman.c')
-rw-r--r--sys/kern/subr_rman.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
index b068af3..754695b 100644
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -234,7 +234,7 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
rstart += bound - (rstart & ~bmask);
} while ((rstart & amask) != 0 && rstart < end &&
rstart < s->r_end);
- rend = ulmin(s->r_end, ulmax(rstart + count, end));
+ rend = ulmin(s->r_end, ulmax(rstart + count - 1, end));
if (rstart > rend) {
DPRINTF(("adjusted start exceeds end\n"));
continue;
@@ -334,7 +334,7 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
if ((s->r_flags & flags) != flags)
continue;
rstart = ulmax(s->r_start, start);
- rend = ulmin(s->r_end, ulmax(start + count, end));
+ rend = ulmin(s->r_end, ulmax(start + count - 1, end));
if (s->r_start >= start && s->r_end <= end
&& (s->r_end - s->r_start + 1) == count &&
(s->r_start & amask) == 0 &&
OpenPOWER on IntegriCloud