]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
NFS: Use kcalloc() when allocating arrays
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 20 Jan 2012 23:57:02 +0000 (18:57 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 1 Feb 2012 00:28:22 +0000 (19:28 -0500)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/blocklayout/extents.c
fs/nfs/pnfs.c

index 1abac09f7cd5f9fd46cc07401873067e49a4b7f7..1f9a6032796b0ff239f2337fae7b656deb71ced6 100644 (file)
@@ -147,7 +147,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++) {
index 17149a4900653af5326dfd6e0490e6e439b1426f..92927878c2f8f9fb6568a2c5c54faeb1e8cd50cc 100644 (file)
@@ -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;