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]
Date:   Fri, 20 May 2022 00:59:12 -0700
From:   Joe Perches <joe@...ches.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        gregkh@...uxfoundation.org
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Rafał Miłecki <rafal@...ecki.pl>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: Re: [PATCH v3] nvmem: brcm_nvram: check for allocation failure

On Fri, 2022-05-20 at 09:45 +0300, Dan Carpenter wrote:
> Check for if the kcalloc() fails.
> 
> Cc: stable@...r.kernel.org
> Fixes: 6e977eaa8280 ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> Acked-by: Rafał Miłecki <rafal@...ecki.pl>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
> ---
> v3: Update fixes tag
> v2: I don't think anything changed in v2?  Added tags?
[]
> diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c
[]
> @@ -97,6 +97,8 @@ static int brcm_nvram_parse(struct brcm_nvram *priv)
>  	len = le32_to_cpu(header.len);
>  
>  	data = kcalloc(1, len, GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;

trivia:

Not sure the kcalloc(1. ..) is useful.

It might be simpler using kzalloc, though given the memcpy_fromio
below a kcalloc/kzalloc seems dubious and kmalloc could be used.

>  	memcpy_fromio(data, priv->base, len);
>  	data[len - 1] = '\0';
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ