summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-04-14 21:35:25 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:38:11 -0800
commitd006c0fd9ae4cdc8aaf9e2802aefa78672e381b4 (patch)
tree0fd53830311475cef67e88063982bf9e20ce0f8c /kernel
parentc69e7f2ea7d1d77dc5b49c07b9a6fdabffa26d06 (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 4f3a6481e4d5..2a8a61c666ba 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -319,8 +319,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)