From: Trond Myklebust Date: Fri, 20 Jan 2012 23:57:02 +0000 (-0500) Subject: NFS: Use kcalloc() when allocating arrays X-Git-Tag: v3.2.29~91 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59f704cddfbc75c9118ce0e669295e1afed6db03;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git NFS: Use kcalloc() when allocating arrays commit 7d9dea915fe333357912bce2d624ee848dfbd890 upstream. Signed-off-by: Trond Myklebust Signed-off-by: Ben Hutchings --- diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c index c69682a..4e2ee99 100644 --- a/fs/nfs/blocklayout/extents.c +++ b/fs/nfs/blocklayout/extents.c @@ -153,7 +153,7 @@ static int _preload_range(struct pnfs_inval_markings *marks, count = (int)(end - start) / (int)tree->mtt_step_size; /* Pre-malloc what memory we might need */ - storage = kmalloc(sizeof(*storage) * count, GFP_NOFS); + storage = kcalloc(count, sizeof(*storage), GFP_NOFS); if (!storage) return -ENOMEM; for (i = 0; i < count; i++) { diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index f881a63..4dfc3f1 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -590,7 +590,7 @@ send_layoutget(struct pnfs_layout_hdr *lo, max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; max_pages = max_resp_sz >> PAGE_SHIFT; - pages = kzalloc(max_pages * sizeof(struct page *), gfp_flags); + pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags); if (!pages) goto out_err_free;