summaryrefslogtreecommitdiffstats
path: root/sys/dev/md
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-27 10:14:36 +0000
committerphk <phk@FreeBSD.org>2003-03-27 10:14:36 +0000
commit8db28f05432baad8e72932318b1ee39453f0c392 (patch)
tree19672400ead1d7eb137c5a685065535e1c268763 /sys/dev/md
parenta90fb3254ba5b0c461c6f52baca7fab7f1565268 (diff)
downloadFreeBSD-src-8db28f05432baad8e72932318b1ee39453f0c392.zip
FreeBSD-src-8db28f05432baad8e72932318b1ee39453f0c392.tar.gz
Allocate the toplevel indir with M_WAITOK to avoid complicating things
needlessly. Detected by: rwatsons EvilMalloc(9)
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 94fa730..4b6cba1 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -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);
}
OpenPOWER on IntegriCloud