Skip to content

Commit 89ccf18

Browse files
jognesspmladek
authored andcommitted
printk: fix kmsg_dump_get_buffer length calulations
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: e2ae715 ("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
1 parent 668af87 commit 89ccf18

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/printk/printk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,7 +3423,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
34233423
while (prb_read_valid_info(prb, seq, &info, &line_count)) {
34243424
if (r.info->seq >= dumper->next_seq)
34253425
break;
3426-
l += get_record_print_text_size(&info, line_count, true, time);
3426+
l += get_record_print_text_size(&info, line_count, syslog, time);
34273427
seq = r.info->seq + 1;
34283428
}
34293429

@@ -3433,7 +3433,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
34333433
&info, &line_count)) {
34343434
if (r.info->seq >= dumper->next_seq)
34353435
break;
3436-
l -= get_record_print_text_size(&info, line_count, true, time);
3436+
l -= get_record_print_text_size(&info, line_count, syslog, time);
34373437
seq = r.info->seq + 1;
34383438
}
34393439

0 commit comments

Comments
 (0)