aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/mem.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 91dd669273e0..a85f3a361442 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -817,7 +817,7 @@ static ssize_t kmsg_write(struct file * file, const char __user * buf,
817 size_t count, loff_t *ppos) 817 size_t count, loff_t *ppos)
818{ 818{
819 char *tmp; 819 char *tmp;
820 int ret; 820 ssize_t ret;
821 821
822 tmp = kmalloc(count + 1, GFP_KERNEL); 822 tmp = kmalloc(count + 1, GFP_KERNEL);
823 if (tmp == NULL) 823 if (tmp == NULL)
@@ -826,6 +826,9 @@ static ssize_t kmsg_write(struct file * file, const char __user * buf,
826 if (!copy_from_user(tmp, buf, count)) { 826 if (!copy_from_user(tmp, buf, count)) {
827 tmp[count] = 0; 827 tmp[count] = 0;
828 ret = printk("%s", tmp); 828 ret = printk("%s", tmp);
829 if (ret > count)
830 /* printk can add a prefix */
831 ret = count;
829 } 832 }
830 kfree(tmp); 833 kfree(tmp);
831 return ret; 834 return ret;