summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-04-14 21:35:25 -0700
committerBrian Swetland <swetland@google.com>2011-03-29 13:57:49 -0700
commit2f583af105bf096958fc268a966a12d258a8a484 (patch)
treeeb09493979c15aeb9dad28c96862fc67ec4f73b2 /kernel
parent05120dcc3e6bcdf182360de158c0427395d8d42f (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')
-rw-r--r--kernel/printk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 82238c9da259..08f5c22b3d3d 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)