diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-04-14 21:35:25 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-09-29 17:49:21 -0700 |
commit | 703a8808cce6c97ca9bcb824bef77a5a306bbe92 (patch) | |
tree | 48680a2bd9da2ff346295948a6718fbdc4055fca | |
parent | 916040d8b90d025d4445e97f3795907a6b65996c (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.
-rw-r--r-- | kernel/printk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 33d6dcdb4909..2d594092d3e1 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -290,8 +290,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) |