Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109309753
D30280.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
896 B
Referenced Files
None
Subscribers
None
D30280.diff
View Options
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -445,6 +445,8 @@
"length %#jx, flags %x, device %s\n", rm->rm_descr, start, end,
count, flags,
dev == NULL ? "<null>" : device_get_nameunit(dev)));
+ KASSERT(count != 0, ("%s: attempted to allocate an empty range",
+ __func__));
KASSERT((flags & RF_FIRSTSHARE) == 0,
("invalid flags %#x", flags));
new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED;
@@ -520,7 +522,7 @@
DPRINTF(("truncated region: [%#jx, %#jx]; size %#jx (requested %#jx)\n",
rstart, rend, (rend - rstart + 1), count));
- if ((rend - rstart + 1) >= count) {
+ if ((rend - rstart) >= (count - 1)) {
DPRINTF(("candidate region: [%#jx, %#jx], size %#jx\n",
rstart, rend, (rend - rstart + 1)));
if ((s->r_end - s->r_start + 1) == count) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 9:41 AM (6 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16451450
Default Alt Text
D30280.diff (896 B)
Attached To
Mode
D30280: kern/rman: fix overflow in rman_reserve_resource_bound()
Attached
Detach File
Event Timeline
Log In to Comment