mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
printk: fix kmsg_dump_get_buffer length calulations
[ Upstream commit89ccf18f03
] kmsg_dump_get_buffer() uses @syslog to determine if the syslog prefix should be written to the buffer. However, when calculating the maximum number of records that can fit into the buffer, it always counts the bytes from the syslog prefix. Use @syslog when calculating the maximum number of records that can fit into the buffer. Fixes:e2ae715d66
("kmsg - kmsg_dump() use iterator to receive log buffer content") Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20210113164413.1599-1-john.ogness@linutronix.de Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cf3cca5f15
commit
ce4d02da78
1 changed files with 2 additions and 2 deletions
|
@ -3376,7 +3376,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
|
|||
while (prb_read_valid_info(prb, seq, &info, &line_count)) {
|
||||
if (r.info->seq >= dumper->next_seq)
|
||||
break;
|
||||
l += get_record_print_text_size(&info, line_count, true, time);
|
||||
l += get_record_print_text_size(&info, line_count, syslog, time);
|
||||
seq = r.info->seq + 1;
|
||||
}
|
||||
|
||||
|
@ -3386,7 +3386,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
|
|||
&info, &line_count)) {
|
||||
if (r.info->seq >= dumper->next_seq)
|
||||
break;
|
||||
l -= get_record_print_text_size(&info, line_count, true, time);
|
||||
l -= get_record_print_text_size(&info, line_count, syslog, time);
|
||||
seq = r.info->seq + 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue