The recent change to initialization of blists (r324420) relied on '-1'

appearing only where the code explicitly set it, but since much of the
data was not initialized, '-1' appeared other places too, and led to
panics.  Clear the allocated data before initializing nonzero values by
allocating with M_ZERO.

Submitted by:	Doug Moore <dougm@rice.edu>
Reported by:	Oleg V. Nauman <oleg@theweb.org.ua>, cy
Tested by:	Oleg V. Nauman <oleg@theweb.org.ua>
MFC after:	1 week
X-MFC with:	r324420
Differential Revision:	https://reviews.freebsd.org/D12627
This commit is contained in:
Alan Cox 2017-10-09 18:19:06 +00:00
parent 497e8a6bf0
commit 03ca213761

View File

@ -248,7 +248,8 @@ blist_create(daddr_t blocks, int flags)
nodes += last_block + 1;
last_block /= BLIST_META_RADIX;
}
bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags);
bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags |
M_ZERO);
if (bl == NULL)
return (NULL);