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

Showing the changes to kernel (1 of 1 file). Show all

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
3423 while (prb_read_valid_info(prb, seq, &info, &line_count)) {3423 while (prb_read_valid_info(prb, seq, &info, &line_count)) {
3424 if (r.info->seq >= dumper->next_seq)3424 if (r.info->seq >= dumper->next_seq)
3425 break;3425 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);
3427 seq = r.info->seq + 1;3427 seq = r.info->seq + 1;
3428 }3428 }
3429 3429
@@ -3433,7 +3433,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, · 3 unmodified lines
3433 &info, &line_count)) {3433 &info, &line_count)) {
3434 if (r.info->seq >= dumper->next_seq)3434 if (r.info->seq >= dumper->next_seq)
3435 break;3435 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);
3437 seq = r.info->seq + 1;3437 seq = r.info->seq + 1;
3438 }3438 }
3439 3439

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