]> git.baikalelectronics.ru Git - kernel.git/commit
printk: fix kmsg_dump_get_buffer length calulations
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 13 Jan 2021 16:44:13 +0000 (17:50 +0106)
committerPetr Mladek <pmladek@suse.com>
Fri, 15 Jan 2021 10:32:52 +0000 (11:32 +0100)
commit64c9f052906e5b6ddebaa267ef4fb1095a6312bc
treefa4804a4f423cfe28ee0d4c7b469716c8ab5bcf5
parent9bc4efb5b84ae2b380c889675e5e364697b3fea3
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: 40fc125f24b5 ("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
kernel/printk/printk.c