diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-11 17:49:13 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-11 19:02:52 -0500 |
commit | a4f743a6bb201662962fa888e3f978583d61691e (patch) | |
tree | 2cb87928f3586c843c6a0b6043c2932f2d5ed07d /fs | |
parent | d8ba1f971497c19cf80da1ea5391a46a5f9fbd41 (diff) |
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')
-rw-r--r-- | fs/nfs/callback_xdr.c | 4 |
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, | |||
313 | goto out; | 313 | goto out; |
314 | } | 314 | } |
315 | 315 | ||
316 | args->devs = kmalloc(n * sizeof(*args->devs), GFP_KERNEL); | 316 | args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL); |
317 | if (!args->devs) { | 317 | if (!args->devs) { |
318 | status = htonl(NFS4ERR_DELAY); | 318 | status = htonl(NFS4ERR_DELAY); |
319 | goto out; | 319 | goto out; |
@@ -415,7 +415,7 @@ static __be32 decode_rc_list(struct xdr_stream *xdr, | |||
415 | rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)); | 415 | rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)); |
416 | if (unlikely(p == NULL)) | 416 | if (unlikely(p == NULL)) |
417 | goto out; | 417 | goto out; |
418 | rc_list->rcl_refcalls = kmalloc(rc_list->rcl_nrefcalls * | 418 | rc_list->rcl_refcalls = kmalloc_array(rc_list->rcl_nrefcalls, |
419 | sizeof(*rc_list->rcl_refcalls), | 419 | sizeof(*rc_list->rcl_refcalls), |
420 | GFP_KERNEL); | 420 | GFP_KERNEL); |
421 | if (unlikely(rc_list->rcl_refcalls == NULL)) | 421 | if (unlikely(rc_list->rcl_refcalls == NULL)) |