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.
This commit is contained in:
Arve Hjønnevåg 2008-04-14 21:35:25 -07:00 committed by Colin Cross
parent 572b262cd3
commit ee51cfa5c8

View File

@ -322,8 +322,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)