“9f6ff24b0ad0ab3202cc5bd6c951440b9374d814”上不存在“...java/lang/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 2d58fce6 编写于 作者: J John Ogness 提交者: Zheng Zengkai

printk: fix kmsg_dump_get_buffer length calulations

stable inclusion
from stable-5.10.11
commit ce4d02da78a30e6ba6ed61a745900ae49985ba1e
bugzilla: 47621

--------------------------------

[ Upstream commit 89ccf18f ]

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: e2ae715d ("kmsg - kmsg_dump() use iterator to receive log buffer content")
Signed-off-by: NJohn Ogness <john.ogness@linutronix.de>
Reviewed-by: NPetr Mladek <pmladek@suse.com>
Acked-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: NPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210113164413.1599-1-john.ogness@linutronix.deSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 f03a0118
...@@ -3376,7 +3376,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, ...@@ -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)) { while (prb_read_valid_info(prb, seq, &info, &line_count)) {
if (r.info->seq >= dumper->next_seq) if (r.info->seq >= dumper->next_seq)
break; 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; seq = r.info->seq + 1;
} }
...@@ -3386,7 +3386,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, ...@@ -3386,7 +3386,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
&info, &line_count)) { &info, &line_count)) {
if (r.info->seq >= dumper->next_seq) if (r.info->seq >= dumper->next_seq)
break; 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; seq = r.info->seq + 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册