Mark Johnston 2783335cae blist: Correct the node count computed in blist_create()
Commit bb4a27f927a1 added the ability to allocate a span of blocks
crossing a meta node boundary.  To ensure that blst_next_leaf_alloc()
does not walk past the end of the tree, an extra all-zero meta node
needs to be present at the end of the allocation, and
blst_next_leaf_alloc() is implemented such that the presence of this
node terminates the search.

blist_create() computes the number of nodes required.  It had two
problems:
1. When the size of the blist is a power of BLIST_RADIX, we would
   unnecessarily allocate an extra level in the tree.
2. When the size of the blist is a multiple of BLIST_RADIX, we would
   fail to allocate a terminator node.  In this case,
   blst_next_leaf_alloc() could scan beyond the bounds of the
   allocation.  This was found using KASAN.

Modify blist_create() to handle these cases correctly.

Reported by:	pho
Reviewed by:	dougm
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31158
2021-07-13 17:47:27 -04:00
..
2021-01-02 19:57:58 -07:00
2021-06-07 16:45:50 -04:00
2020-10-05 15:54:19 +00:00
2020-11-19 02:50:48 +00:00
2020-12-04 18:56:44 +00:00
2021-04-18 11:19:15 -06:00
2021-04-12 11:42:21 -03:00
2021-05-05 12:32:13 -06:00
2020-11-05 15:08:56 +00:00
2020-11-09 00:34:23 +00:00
2020-08-13 20:48:14 +00:00
2021-04-02 15:41:51 +03:00
2019-02-20 09:38:19 +00:00
2021-07-07 07:22:35 -04:00
2020-12-01 16:06:31 +00:00
2021-04-07 14:33:02 -04:00
2020-01-12 23:52:16 +00:00
2021-04-18 11:14:17 -06:00
2020-08-27 05:11:15 +00:00
2021-07-07 10:40:02 -04:00
2021-04-15 12:48:24 +03:00
2021-04-13 17:42:20 -04:00
2021-07-12 07:03:14 +02:00
2021-04-18 11:19:15 -06:00
2021-04-18 11:19:15 -06:00
2021-06-23 23:46:15 +03:00