mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
convert a bunch of open-coded instances of memdup_user_nul()
A _lot_ of ->write() instances were open-coding it; some are converted to memdup_user_nul(), a lot more remain... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7e935c7ca1
commit
16e5c1fc36
12 changed files with 71 additions and 197 deletions
|
|
@ -349,16 +349,10 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer,
|
|||
if (count >= BLK_TN_MAX_MSG)
|
||||
return -EINVAL;
|
||||
|
||||
msg = kmalloc(count + 1, GFP_KERNEL);
|
||||
if (msg == NULL)
|
||||
return -ENOMEM;
|
||||
msg = memdup_user_nul(buffer, count);
|
||||
if (IS_ERR(msg))
|
||||
return PTR_ERR(msg);
|
||||
|
||||
if (copy_from_user(msg, buffer, count)) {
|
||||
kfree(msg);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
msg[count] = '\0';
|
||||
bt = filp->private_data;
|
||||
__trace_note_message(bt, "%s", msg);
|
||||
kfree(msg);
|
||||
|
|
|
|||
Loading…
Reference in a new issue