summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/llite/dir.c
diff options
context:
space:
mode:
authorTobin C Harding <me@tobin.cc>2016-05-23 10:14:22 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-07 22:38:19 -0700
commitc6c7a17010697377df1241a2914e3c1e5582e234 (patch)
treeb92f23f3d53300118e51d441e05ea96520ad90c6 /drivers/staging/lustre/lustre/llite/dir.c
parentdb3c16cdde24ecd59df0f24f93f1a4ba177f4b82 (diff)
staging: lustre: llite: kzalloc/copy_to_user to memdup_user
kzalloc call followed by copy_to_user can be replaced by call to memdup_user. Signed-off-by: Tobin C Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/dir.c')
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 4b00d1ac84fb..85c50e0d5565 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1076,17 +1076,11 @@ static int copy_and_ioctl(int cmd, struct obd_export *exp,
void *copy;
int rc;
- copy = kzalloc(size, GFP_NOFS);
- if (!copy)
- return -ENOMEM;
-
- if (copy_from_user(copy, data, size)) {
- rc = -EFAULT;
- goto out;
- }
+ copy = memdup_user(data, size);
+ if (IS_ERR(copy))
+ return PTR_ERR(copy);
rc = obd_iocontrol(cmd, exp, size, copy, NULL);
-out:
kfree(copy);
return rc;