aboutsummaryrefslogtreecommitdiff
path: root/lib/test_fortify/write_overflow-strncpy-src.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2023-08-10 22:45:32 -0700
committerPetr Mladek <[email protected]>2023-08-14 13:05:22 +0200
commit53e9e33ede37a247d926db5e4a9e56b55204e66c (patch)
treeed369146574085fecd752919ec0a7bec0d7b874e /lib/test_fortify/write_overflow-strncpy-src.c
parentcd47fe860185a8d385bba693ab79497fdf12cd78 (diff)
printk: ringbuffer: Fix truncating buffer size min_t cast
If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation. Cc: Petr Mladek <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: John Ogness <[email protected]> Reported-by: Vijay Balakrishna <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Fixes: b6cf8b3f3312 ("printk: add lockless ringbuffer") Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Tested-by: Vijay Balakrishna <[email protected]> Tested-by: Guilherme G. Piccoli <[email protected]> # Steam Deck Reviewed-by: Tyler Hicks (Microsoft) <[email protected]> Tested-by: Tyler Hicks (Microsoft) <[email protected]> Reviewed-by: John Ogness <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions