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: <aUTG-tlRzFWdkLE2@gondor.apana.org.au>
Date: Fri, 19 Dec 2025 11:31:06 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Gongwei Li <13875017792@....com>
Cc: horia.geanta@....com, pankaj.gupta@....com, gaurav.jain@....com,
	davem@...emloft.net, linux-crypto@...r.kernel.org,
	linux-kernel@...r.kernel.org, Gongwei Li <ligongwei@...inos.cn>
Subject: Re: [PATCH 1/1] crypto: caam - use kmalloc_array() instead of
 kmalloc()

On Fri, Nov 21, 2025 at 10:44:56AM +0800, Gongwei Li wrote:
> From: Gongwei Li <ligongwei@...inos.cn>
> 
> Replace kmalloc() with kmalloc_array() to prevent potential
> overflow, as recommended in Documentation/process/deprecated.rst.
> 
> Signed-off-by: Gongwei Li <ligongwei@...inos.cn>
> ---
>  drivers/crypto/caam/ctrl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index 320be5d77737..81583251b1f6 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -208,7 +208,7 @@ static int deinstantiate_rng(struct device *ctrldev, int state_handle_mask)
>  	u32 *desc, status;
>  	int sh_idx, ret = 0;
>  
> -	desc = kmalloc(CAAM_CMD_SZ * 3, GFP_KERNEL);
> +	desc = kmalloc_array(3, CAAM_CMD_SZ, GFP_KERNEL);

This is pointless because CAAM_CMD_SZ is a constant.

Cheers,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ