1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Allocate the toplevel indir with M_WAITOK to avoid complicating things

needlessly.

Detected by:	rwatsons EvilMalloc(9)
This commit is contained in:
Poul-Henning Kamp 2003-03-27 10:14:36 +00:00
parent b11003f306
commit 83e13864c3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112702

View File

@ -240,9 +240,13 @@ dimension(off_t size)
/*
* XXX: the top layer is probably not fully populated, so we allocate
* too much space for ip->array in new_indir() here.
* too much space for ip->array in here.
*/
ip = new_indir(layer * nshift);
ip = malloc(sizeof *ip, M_MD, M_WAITOK | M_ZERO);
ip->array = malloc(sizeof(uintptr_t) * NINDIR,
M_MDSECT, M_WAITOK | M_ZERO);
ip->total = NINDIR;
ip->shift = layer * nshift;
return (ip);
}