diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-04-14 21:35:25 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-02-14 11:26:34 -0800 |
commit | a828919ab77fa1e6f4b6091df7f9975e8607ebfb (patch) | |
tree | 9603f5cc08f272f8666d79b823b7dd491642b518 /kernel/printk.c | |
parent | 9a710981d766164396786e25ebcad450569bdb1c (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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 9f9d86383cb7..d438eedae6e4 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) |