summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_rman.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_rman.c')
-rw-r--r--sys/kern/subr_rman.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
index b53030a..4101c86 100644
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -466,8 +466,8 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
}
amask = (1ul << RF_ALIGNMENT(flags)) - 1;
- if (start + amask < start) {
- DPRINTF(("start+amask wrapped around\n"));
+ if (start > ULONG_MAX - amask) {
+ DPRINTF(("start+amask would wrap around\n"));
goto out;
}
@@ -487,8 +487,8 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
s->r_start, end));
break;
}
- if (s->r_start + amask < s->r_start) {
- DPRINTF(("s->r_start (%#lx) + amask (%#lx) wrapped\n",
+ if (s->r_start > ULONG_MAX - amask) {
+ DPRINTF(("s->r_start (%#lx) + amask (%#lx) too large\n",
s->r_start, amask));
break;
}
OpenPOWER on IntegriCloud