aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r--drivers/char/mem.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 78923a9f5345..8fc04b4f311f 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -810,11 +810,11 @@ static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv,
810 unsigned long count, loff_t pos) 810 unsigned long count, loff_t pos)
811{ 811{
812 char *line, *p; 812 char *line, *p;
813 int len, i; 813 int i;
814 ssize_t ret = -EFAULT; 814 ssize_t ret = -EFAULT;
815 size_t len = iov_length(iv, count);
815 816
816 len = iov_length(iv, count); 817 line = kmalloc(len + 1, GFP_KERNEL);
817 line = p = kmalloc(len + 1, GFP_KERNEL);
818 if (line == NULL) 818 if (line == NULL)
819 return -ENOMEM; 819 return -ENOMEM;
820 820
@@ -822,6 +822,7 @@ static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv,
822 * copy all vectors into a single string, to ensure we do 822 * copy all vectors into a single string, to ensure we do
823 * not interleave our log line with other printk calls 823 * not interleave our log line with other printk calls
824 */ 824 */
825 p = line;
825 for (i = 0; i < count; i++) { 826 for (i = 0; i < count; i++) {
826 if (copy_from_user(p, iv[i].iov_base, iv[i].iov_len)) 827 if (copy_from_user(p, iv[i].iov_base, iv[i].iov_len))
827 goto out; 828 goto out;