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 04ac32b..cbb1797 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 44bf014..48f8dcd 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;