summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_rman.c
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2002-08-29 12:39:21 +0000
committeriwasaki <iwasaki@FreeBSD.org>2002-08-29 12:39:21 +0000
commitf3872b5db52561c99009ec5d27daca1d178a656d (patch)
treea557f1b29743da15bfceca3fb061b38d28acda5d /sys/kern/subr_rman.c
parentf8c5ceb68d89549fc7c635ae8be730ed4dc1cca8 (diff)
downloadFreeBSD-src-f3872b5db52561c99009ec5d27daca1d178a656d.zip
FreeBSD-src-f3872b5db52561c99009ec5d27daca1d178a656d.tar.gz
Add sanity check seeing if adjusted start address exceeds end address
after boundary and alignment adjustment.
Diffstat (limited to 'sys/kern/subr_rman.c')
-rw-r--r--sys/kern/subr_rman.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
index 85af088..7c5502e 100644
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -232,6 +232,10 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
} while ((rstart & amask) != 0 && rstart < end &&
rstart < s->r_end);
rend = ulmin(s->r_end, ulmax(rstart + count, end));
+ if (rstart > rend) {
+ DPRINTF(("adjusted start exceeds end\n"));
+ continue;
+ }
DPRINTF(("truncated region: [%#lx, %#lx]; size %#lx (requested %#lx)\n",
rstart, rend, (rend - rstart + 1), count));
OpenPOWER on IntegriCloud