FS/NFS: replace count*size kzalloc by kcalloc
authorFabian Frederick <fabf@skynet.be>
Wed, 25 Jun 2014 18:26:21 +0000 (20:26 +0200)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 25 Jun 2014 23:02:14 +0000 (19:02 -0400)
kcalloc manages count*sizeof overflow.

Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/blocklayout/blocklayout.c
fs/nfs/filelayout/filelayoutdev.c

index 04ac32b339f8c03572ac36df400f32c2db42995d..cbb1797149d5731a77f22b97fc4a3ba2cdfbacfd 100644 (file)
@@ -1062,7 +1062,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh,
                return ERR_PTR(-ENOMEM);
        }
 
-       pages = kzalloc(max_pages * sizeof(struct page *), GFP_NOFS);
+       pages = kcalloc(max_pages, sizeof(struct page *), GFP_NOFS);
        if (pages == NULL) {
                kfree(dev);
                return ERR_PTR(-ENOMEM);
index 44bf0140a4c77e2d787f8ee154aa0436f6d5d615..48f8dcdb75db09d282f4fbf7f98d5a9cf7e11e64 100644 (file)
@@ -695,7 +695,7 @@ filelayout_get_device_info(struct inode *inode,
        if (pdev == NULL)
                return NULL;
 
-       pages = kzalloc(max_pages * sizeof(struct page *), gfp_flags);
+       pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags);
        if (pages == NULL) {
                kfree(pdev);
                return NULL;