Be even more paranoid about overflow.
Requested by: ache
This commit is contained in:
parent
ae866603c7
commit
11e104c50f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=265931
@ -466,8 +466,8 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
amask = (1ul << RF_ALIGNMENT(flags)) - 1;
|
amask = (1ul << RF_ALIGNMENT(flags)) - 1;
|
||||||
if (start + amask < start) {
|
if (start > ULONG_MAX - amask) {
|
||||||
DPRINTF(("start+amask wrapped around\n"));
|
DPRINTF(("start+amask would wrap around\n"));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,8 +487,8 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
|
|||||||
s->r_start, end));
|
s->r_start, end));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (s->r_start + amask < s->r_start) {
|
if (s->r_start > ULONG_MAX - amask) {
|
||||||
DPRINTF(("s->r_start (%#lx) + amask (%#lx) wrapped\n",
|
DPRINTF(("s->r_start (%#lx) + amask (%#lx) too large\n",
|
||||||
s->r_start, amask));
|
s->r_start, amask));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user