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