Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170665058
D31158.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
729 B
Referenced Files
None
Subscribers
None
D31158.id.diff
View Options
diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c
--- a/sys/kern/subr_blist.c
+++ b/sys/kern/subr_blist.c
@@ -244,8 +244,16 @@
* Calculate the radix and node count used for scanning.
*/
nodes = 1;
- for (radix = 1; radix <= blocks / BLIST_RADIX; radix *= BLIST_RADIX)
- nodes += 1 + (blocks - 1) / radix / BLIST_RADIX;
+ for (radix = 1; (blocks - 1) / BLIST_RADIX / radix > 0;
+ radix *= BLIST_RADIX)
+ nodes += 1 + (blocks - 1) / BLIST_RADIX / radix;
+
+ /*
+ * Include a sentinel node to ensure that cross-leaf scans stay within
+ * the bounds of the allocation.
+ */
+ if (blocks % BLIST_RADIX == 0)
+ nodes++;
bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags |
M_ZERO);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 6, 9:58 PM (3 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38261319
Default Alt Text
D31158.id.diff (729 B)
Attached To
Mode
D31158: blist: Correct the node count used for allocation.
Attached
Detach File
Event Timeline
Log In to Comment