[GIT PULL] printk regression fixes for 5.11-rc5

From: Petr Mladek
Date: Thu Jan 21 2021 - 11:11:51 EST


Linus,

please pull three printk fixes from

git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git tags/printk-for-5.11-printk-rework-fixup

===============================

- Fix line counting and buffer size calculation. Both regressions
caused that a reader buffer might not get filled as much as possible.

- Restore non-documented behavior of printk() reader API and make it
official. It did not fill the last byte of the provided buffer before
5.10. Two architectures, powerpc and um, used it to add
the trailing '\0'. There might theoretically be more callers
depending on this behavior in userspace.

===============================

All three regressions were found and fixed by John when
working on another changes.

----------------------------------------------------------------
John Ogness (3):
printk: ringbuffer: fix line counting
printk: fix kmsg_dump_get_buffer length calulations
printk: fix buffer overflow potential for print_text()

Petr Mladek (1):
Merge branch 'printk-rework' into for-linus

kernel/printk/printk.c | 40 ++++++++++++++++++++++++++++-----------
kernel/printk/printk_ringbuffer.c | 2 +-
2 files changed, 30 insertions(+), 12 deletions(-)