Re: [PATCH] printk: ringbuffer: Fix truncating buffer size min_t cast

From: John Ogness
Date: Mon Aug 14 2023 - 02:22:07 EST


On 2023-08-10, Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> 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.

Thanks for tracking this down.

Reviewed-by: John Ogness <john.ogness@xxxxxxxxxxxxx>