From 0394ebdb09a9aac1f1e67e7ec22450a804334568 Mon Sep 17 00:00:00 2001 From: tedu Date: Sun, 13 Jul 2014 23:18:01 +0000 Subject: [PATCH] use mallocarray --- sys/ufs/ufs/ufs_dirhash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index 62d2c49455b..9eff2f8f97a 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_dirhash.c,v 1.26 2014/07/12 18:44:01 tedu Exp $ */ +/* $OpenBSD: ufs_dirhash.c,v 1.27 2014/07/13 23:18:01 tedu Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. * @@ -174,9 +174,9 @@ ufsdirhash_build(struct inode *ip) DIRHASHLIST_UNLOCK(); return (-1); } - dh->dh_hash = malloc(narrays * sizeof(dh->dh_hash[0]), + dh->dh_hash = mallocarray(narrays, sizeof(dh->dh_hash[0]), M_DIRHASH, M_NOWAIT|M_ZERO); - dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]), + dh->dh_blkfree = mallocarray(nblocks, sizeof(dh->dh_blkfree[0]), M_DIRHASH, M_NOWAIT | M_ZERO); if (dh->dh_hash == NULL || dh->dh_blkfree == NULL) goto fail; -- 2.20.1