mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
[um] mconsole: don't open-code memdup_user_nul()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
1ceb36285c
commit
793b796ebf
@ -748,19 +748,11 @@ static ssize_t mconsole_proc_write(struct file *file,
|
||||
{
|
||||
char *buf;
|
||||
|
||||
buf = kmalloc(count + 1, GFP_KERNEL);
|
||||
if (buf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(buf, buffer, count)) {
|
||||
count = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
buf[count] = '\0';
|
||||
buf = memdup_user_nul(buffer, count);
|
||||
if (IS_ERR(buf))
|
||||
return PTR_ERR(buf);
|
||||
|
||||
mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
|
||||
out:
|
||||
kfree(buf);
|
||||
return count;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user