diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-04-14 21:35:25 -0700 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2010-02-08 15:35:53 -0800 |
commit | 8a3025c963926f1cc36b15f6b95b9da0c1ab1cdf (patch) | |
tree | 844446a8e6956428a862f557cb2d31be233ad127 /kernel | |
parent | afa82e25d4d6ab6500828cd7cc9d395a9c1e5d69 (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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 448fdc68c8df..a2c0a05d4a85 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) |