diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-02 14:53:28 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-04 10:29:45 -0500 |
commit | 793b796ebfcb3157fe80056a719096a550f0c7d0 (patch) | |
tree | 0be940b462012ee2887a3d09dfd60ade3edacddd /arch/um | |
parent | 1ceb36285c256347ffa062b7b1b593f801b6697b (diff) |
[um] mconsole: don't open-code memdup_user_nul()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 29880c9b324e..b821b13d343a 100644 --- 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, | |||
748 | { | 748 | { |
749 | char *buf; | 749 | char *buf; |
750 | 750 | ||
751 | buf = kmalloc(count + 1, GFP_KERNEL); | 751 | buf = memdup_user_nul(buffer, count); |
752 | if (buf == NULL) | 752 | if (IS_ERR(buf)) |
753 | return -ENOMEM; | 753 | return PTR_ERR(buf); |
754 | |||
755 | if (copy_from_user(buf, buffer, count)) { | ||
756 | count = -EFAULT; | ||
757 | goto out; | ||
758 | } | ||
759 | |||
760 | buf[count] = '\0'; | ||
761 | 754 | ||
762 | mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count); | 755 | mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count); |
763 | out: | ||
764 | kfree(buf); | 756 | kfree(buf); |
765 | return count; | 757 | return count; |
766 | } | 758 | } |