Commit 7d9dea91 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Use kcalloc() when allocating arrays

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 4601df20
...@@ -147,7 +147,7 @@ static int _preload_range(struct pnfs_inval_markings *marks, ...@@ -147,7 +147,7 @@ static int _preload_range(struct pnfs_inval_markings *marks,
count = (int)(end - start) / (int)tree->mtt_step_size; count = (int)(end - start) / (int)tree->mtt_step_size;
/* Pre-malloc what memory we might need */ /* Pre-malloc what memory we might need */
storage = kmalloc(sizeof(*storage) * count, GFP_NOFS); storage = kcalloc(count, sizeof(*storage), GFP_NOFS);
if (!storage) if (!storage)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
......
...@@ -590,7 +590,7 @@ send_layoutget(struct pnfs_layout_hdr *lo, ...@@ -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_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz;
max_pages = max_resp_sz >> PAGE_SHIFT; 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) if (!pages)
goto out_err_free; goto out_err_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment