summaryrefslogtreecommitdiff
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-04-14 21:35:25 -0700
committerDima Zavin <dima@android.com>2011-02-02 11:19:01 -0800
commit3cb8160c08dd46c0bf902a8573271af022c66863 (patch)
treebfad304736f5818bae3f96f3742ea82ae82ea3f3 /kernel/printk.c
parent1f3462db9a56d05c65e0d39b2ce9161089438967 (diff)
printk: Fix log_buf_copy termination.
If idx was non-zero and the log had wrapped, len did not get truncated to stop at the last byte written to the log.
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index ffcca7145bf..01c7c26e8bb 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -285,8 +285,8 @@ int log_buf_copy(char *dest, int idx, int len)
if (idx < 0 || idx >= max) {
ret = -1;
} else {
- if (len > max)
- len = max;
+ if (len > max - idx)
+ len = max - idx;
ret = len;
idx += (log_end - max);
while (len-- > 0)