diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-04-14 21:35:25 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:14 -0700 |
commit | 0da19af0b8c8b8d8bd19a262479d49d8061c0c13 (patch) | |
tree | af1ba23b042e0ebf4f075c552e217362a45d1df3 /kernel/printk.c | |
parent | fc4fb2825c927af3a67ff5120816e2a37748d6af (diff) | |
download | kernel_samsung_aries-0da19af0b8c8b8d8bd19a262479d49d8061c0c13.zip kernel_samsung_aries-0da19af0b8c8b8d8bd19a262479d49d8061c0c13.tar.gz kernel_samsung_aries-0da19af0b8c8b8d8bd19a262479d49d8061c0c13.tar.bz2 |
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 c78ed88..cd8fbf3 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) |