lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aTmQFgGhghkh588E@lizhi-Precision-Tower-5810>
Date: Wed, 10 Dec 2025 10:21:58 -0500
From: Frank Li <Frank.li@....com>
To: Carlos Song <carlos.song@....com>
Cc: broonie@...nel.org, daniel.baluta@....com, david.laight@...box.com,
	andriy.shevchenko@...el.com, linux-spi@...r.kernel.org,
	imx@...ts.linux.dev, linux-kernel@...r.kernel.org,
	David Laight <david.laight.linux@...il.com>
Subject: Re: [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min()

On Wed, Dec 10, 2025 at 06:50:01PM +0800, Carlos Song wrote:
> Current min() has supported comparison by normal integer promotion rules,
> so explicit type casts or min_t() are not needed.
>
> Signed-off-by: Carlos Song <carlos.song@....com>
> Reviewed-by: David Laight <david.laight.linux@...il.com>

Reviewed-by: Frank Li <Frank.Li@....com>

> ---
> Change since v2:
> * remove 'Fixes' tag according to David's comment
> * add review-by tag.
> Change since v1:
> * remove unused comment according to David's comment
> * improve commit log according to Frank's comment
> ---
>  drivers/spi/spi-fsl-lpspi.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index 065456aba2ae..8f45ead23836 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -486,15 +486,7 @@ static int fsl_lpspi_setup_transfer(struct spi_controller *controller,
>  		fsl_lpspi->tx = fsl_lpspi_buf_tx_u32;
>  	}
>
> -	/*
> -	 * t->len is 'unsigned' and txfifosize and watermrk is 'u8', force
> -	 * type cast is inevitable. When len > 255, len will be truncated in min_t(),
> -	 * it caused wrong watermark set. 'unsigned int' is as the designated type
> -	 * for min_t() to avoid truncation.
> -	 */
> -	fsl_lpspi->watermark = min_t(unsigned int,
> -				     fsl_lpspi->txfifosize,
> -				     t->len);
> +	fsl_lpspi->watermark = min(fsl_lpspi->txfifosize, t->len);
>
>  	if (fsl_lpspi_can_dma(controller, spi, t))
>  		fsl_lpspi->usedma = true;
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ