[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEnQRZDwPxRLZDy0+s2og15=C0G6ZnNPUEstuFTn5JLSFajJaQ@mail.gmail.com>
Date: Fri, 21 Nov 2025 11:30:59 +0200
From: Daniel Baluta <daniel.baluta@...il.com>
To: carlos.song@....com
Cc: Frank.Li@....com, broonie@...nel.org, rongqianfeng@...o.com,
linux-spi@...r.kernel.org, imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: spi-fsl-lpspi: fix watermark truncation caused by
type cast
On Mon, Nov 17, 2025 at 5:06 AM <carlos.song@....com> wrote:
>
> From: Carlos Song <carlos.song@....com>
>
> 't->len' is an unsigned integer, while 'watermark' and 'txfifosize' are
> u8. Using min_t with typeof(watermark) forces both values to be cast to
> u8, which truncates len when it exceeds 255. For example, len = 4096
> becomes 0 after casting, resulting in an incorrect watermark value.
>
> Use a wider type in min_t to avoid truncation and ensure the correct
> minimum value is applied.
>
> Fixes: a750050349ea ("spi: spi-fsl-lpspi: use min_t() to improve code")
> Signed-off-by: Carlos Song <carlos.song@....com>
LGTM,
Reviewed-by: Daniel Baluta <daniel.baluta@....com>
Powered by blists - more mailing lists