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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08284d4c-b7fe-4f61-9928-0d9d3329e88b@intel.com>
Date: Wed, 19 Nov 2025 16:50:28 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: david.laight.linux@...il.com, linux-kernel@...r.kernel.org,
 linux-cxl@...r.kernel.org
Cc: Alison Schofield <alison.schofield@...el.com>,
 Dan Williams <dan.j.williams@...el.com>, Davidlohr Bueso
 <dave@...olabs.net>, Ira Weiny <ira.weiny@...el.com>,
 Jonathan Cameron <jonathan.cameron@...wei.com>,
 Vishal Verma <vishal.l.verma@...el.com>
Subject: Re: [PATCH 17/44] drivers/cxl: use min() instead of min_t()



On 11/19/25 3:41 PM, david.laight.linux@...il.com wrote:
> From: David Laight <david.laight.linux@...il.com>
> 
> min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
> Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
> and so cannot discard significant bits.
> 
> In this case the 'unsigned long' value is small enough that the result
> is ok.
> 
> Detected by an extra check added to min_t().
> 
> Signed-off-by: David Laight <david.laight.linux@...il.com>

Acked-by: Dave Jiang <dave.jiang@...el.com>

> ---
>  drivers/cxl/core/mbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index fa6dd0c94656..17aec916e8cd 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -663,7 +663,7 @@ static int cxl_xfer_log(struct cxl_memdev_state *mds, uuid_t *uuid,
>  	u32 offset = 0;
>  
>  	while (remaining) {
> -		u32 xfer_size = min_t(u32, remaining, cxl_mbox->payload_size);
> +		u32 xfer_size = min(remaining, cxl_mbox->payload_size);
>  		struct cxl_mbox_cmd mbox_cmd;
>  		struct cxl_mbox_get_log log;
>  		int rc;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ