]> git.karo-electronics.de Git - karo-tx-linux.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)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 12 Sep 2012 02:36:48 +0000 (03:36 +0100)
commit 7d9dea915fe333357912bce2d624ee848dfbd890 upstream.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/nfs/blocklayout/extents.c
fs/nfs/pnfs.c

index c69682a4262add2006055fcd15e32d93fb9d0867..4e2ee99199510d6c0422f8523744514fda48859f 100644 (file)
@@ -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++) {
index f881a638794294e905e458afccf3a0fc3c7ea570..4dfc3f17a0536b1cb6b5362fd3876d80044ef48d 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;