mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-05-09 08:45:54 +00:00
amdkfd: don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
abb0f6a79f
commit
8f1d57c172
1 changed files with 7 additions and 26 deletions
|
@ -559,19 +559,10 @@ static int kfd_ioctl_dbg_address_watch(struct file *filep,
|
||||||
|
|
||||||
/* this is the actual buffer to work with */
|
/* this is the actual buffer to work with */
|
||||||
|
|
||||||
args_buff = kmalloc(args->buf_size_in_bytes -
|
args_buff = memdup_user(args_buff,
|
||||||
sizeof(*args), GFP_KERNEL);
|
|
||||||
if (args_buff == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
status = copy_from_user(args_buff, cmd_from_user,
|
|
||||||
args->buf_size_in_bytes - sizeof(*args));
|
args->buf_size_in_bytes - sizeof(*args));
|
||||||
|
if (IS_ERR(args_buff))
|
||||||
if (status != 0) {
|
return PTR_ERR(args_buff);
|
||||||
pr_debug("Failed to copy address watch user data\n");
|
|
||||||
kfree(args_buff);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
aw_info.process = p;
|
aw_info.process = p;
|
||||||
|
|
||||||
|
@ -677,22 +668,12 @@ static int kfd_ioctl_dbg_wave_control(struct file *filep,
|
||||||
if (cmd_from_user == NULL)
|
if (cmd_from_user == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* this is the actual buffer to work with */
|
/* copy the entire buffer from user */
|
||||||
|
|
||||||
args_buff = kmalloc(args->buf_size_in_bytes - sizeof(*args),
|
args_buff = memdup_user(cmd_from_user,
|
||||||
GFP_KERNEL);
|
|
||||||
|
|
||||||
if (args_buff == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* Now copy the entire buffer from user */
|
|
||||||
status = copy_from_user(args_buff, cmd_from_user,
|
|
||||||
args->buf_size_in_bytes - sizeof(*args));
|
args->buf_size_in_bytes - sizeof(*args));
|
||||||
if (status != 0) {
|
if (IS_ERR(args_buff))
|
||||||
pr_debug("Failed to copy wave control user data\n");
|
return PTR_ERR(args_buff);
|
||||||
kfree(args_buff);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* move ptr to the start of the "pay-load" area */
|
/* move ptr to the start of the "pay-load" area */
|
||||||
wac_info.process = p;
|
wac_info.process = p;
|
||||||
|
|
Loading…
Add table
Reference in a new issue