Commit c6c7a170 authored by Tobin C Harding's avatar Tobin C Harding Committed by Greg Kroah-Hartman

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: default avatarTobin C Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db3c16cd
...@@ -1076,17 +1076,11 @@ static int copy_and_ioctl(int cmd, struct obd_export *exp, ...@@ -1076,17 +1076,11 @@ static int copy_and_ioctl(int cmd, struct obd_export *exp,
void *copy; void *copy;
int rc; int rc;
copy = kzalloc(size, GFP_NOFS); copy = memdup_user(data, size);
if (!copy) if (IS_ERR(copy))
return -ENOMEM; return PTR_ERR(copy);
if (copy_from_user(copy, data, size)) {
rc = -EFAULT;
goto out;
}
rc = obd_iocontrol(cmd, exp, size, copy, NULL); rc = obd_iocontrol(cmd, exp, size, copy, NULL);
out:
kfree(copy); kfree(copy);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment