projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1ceb362
)
[um] mconsole: don't open-code memdup_user_nul()
author
Al Viro
<viro@zeniv.linux.org.uk>
Sat, 2 Jan 2016 19:53:28 +0000
(14:53 -0500)
committer
Al Viro
<viro@zeniv.linux.org.uk>
Mon, 4 Jan 2016 15:29:45 +0000
(10:29 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/um/drivers/mconsole_kern.c
patch
|
blob
|
blame
|
history
diff --git
a/arch/um/drivers/mconsole_kern.c
b/arch/um/drivers/mconsole_kern.c
index 29880c9b324ed33601c8af02340a4765d9d75b3b..b821b13d343a7bb37e1c260aa59ab5387cba195d 100644
(file)
--- a/
arch/um/drivers/mconsole_kern.c
+++ b/
arch/um/drivers/mconsole_kern.c
@@
-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;
}