summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-02-11 23:49:13 +0100
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-02-12 01:02:52 +0100
commita4f743a6bb201662962fa888e3f978583d61691e (patch)
tree2cb87928f3586c843c6a0b6043c2932f2d5ed07d /fs/nfs
parentNFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args (diff)
downloadlinux-a4f743a6bb201662962fa888e3f978583d61691e.tar.xz
linux-a4f743a6bb201662962fa888e3f978583d61691e.zip
NFSv4.1: Convert open-coded array allocation calls to kmalloc_array()
For added overflow protection... Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback_xdr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 02f8d09e119f..19ca95cdfd9b 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -313,7 +313,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
goto out;
}
- args->devs = kmalloc(n * sizeof(*args->devs), GFP_KERNEL);
+ args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL);
if (!args->devs) {
status = htonl(NFS4ERR_DELAY);
goto out;
@@ -415,7 +415,7 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
if (unlikely(p == NULL))
goto out;
- rc_list->rcl_refcalls = kmalloc(rc_list->rcl_nrefcalls *
+ rc_list->rcl_refcalls = kmalloc_array(rc_list->rcl_nrefcalls,
sizeof(*rc_list->rcl_refcalls),
GFP_KERNEL);
if (unlikely(rc_list->rcl_refcalls == NULL))