commit | 2e81759bc042e8171607e990ef79adba06eccbf8 | [log] [tgz] |
---|---|---|
author | Arve Hjønnevåg <arve@android.com> | Mon Apr 14 21:35:25 2008 -0700 |
committer | Praneeth Bajjuri <praneeth@ti.com> | Mon Sep 19 20:18:57 2011 -0700 |
tree | 5514a7d0d0968628069744b23469f3b2f84a6e1e | |
parent | 70f94aab0ecc3b9617750712d3fdfa458c18113b [diff] [blame] |
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.
diff --git a/kernel/printk.c b/kernel/printk.c index 4f3a648..2a8a61c 100644 --- a/kernel/printk.c +++ b/kernel/printk.c
@@ -319,8 +319,8 @@ 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)