diff options
-rw-r--r-- | kernel/printk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 572730bd8a5c..a2276b916769 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -880,7 +880,9 @@ static int syslog_print(char __user *buf, int size) | |||
880 | syslog_seq++; | 880 | syslog_seq++; |
881 | raw_spin_unlock_irq(&logbuf_lock); | 881 | raw_spin_unlock_irq(&logbuf_lock); |
882 | 882 | ||
883 | if (len > 0 && copy_to_user(buf, text, len)) | 883 | if (len > size) |
884 | len = -EINVAL; | ||
885 | else if (len > 0 && copy_to_user(buf, text, len)) | ||
884 | len = -EFAULT; | 886 | len = -EFAULT; |
885 | 887 | ||
886 | kfree(text); | 888 | kfree(text); |