Commit 793b796e authored by Al Viro's avatar Al Viro

[um] mconsole: don't open-code memdup_user_nul()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1ceb3628
...@@ -748,19 +748,11 @@ static ssize_t mconsole_proc_write(struct file *file, ...@@ -748,19 +748,11 @@ static ssize_t mconsole_proc_write(struct file *file,
{ {
char *buf; char *buf;
buf = kmalloc(count + 1, GFP_KERNEL); buf = memdup_user_nul(buffer, count);
if (buf == NULL) if (IS_ERR(buf))
return -ENOMEM; return PTR_ERR(buf);
if (copy_from_user(buf, buffer, count)) {
count = -EFAULT;
goto out;
}
buf[count] = '\0';
mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count); mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
out:
kfree(buf); kfree(buf);
return count; return count;
} }
......
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