History

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.

John Ogness committed 5 years ago

Commit 89ccf181 parent 668af871 file · +2 −2Browse files

Unified · Split

kernel/printk/printk.c+2−2
@@ -3423,7 +3423,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, · 3422 unmodified lines
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, · 3 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t