NFSv4.1: Use kcalloc() to allocate zeroed arrays instead of kzalloc()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 11 Oct 2012 18:36:52 +0000 (14:36 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 15 Oct 2012 14:49:43 +0000 (10:49 -0400)
Don't circumvent the array size checks.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4filelayout.c

index e7aee566861d67230a85a88168f8690d17534514..2e45fd9c02a38cc9d7b3ee0ee87150fa3a8e7ea8 100644 (file)
@@ -750,7 +750,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
                goto out_err;
 
        if (fl->num_fh > 0) {
-               fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
+               fl->fh_array = kcalloc(fl->num_fh, sizeof(fl->fh_array[0]),
                                       gfp_flags);
                if (!fl->fh_array)
                        goto out_err;