mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
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>
This commit is contained in:
parent
db3c16cdde
commit
c6c7a17010
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user