[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <996eb652-8a18-184b-c163-85e67d67b530@linaro.org>
Date: Fri, 29 Apr 2022 10:33:44 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Rafał Miłecki <rafal@...ecki.pl>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] nvmem: check for allocation failure
On 01/03/2022 08:11, Dan Carpenter wrote:
> Check for if the kcalloc() fails.
>
> Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
Applied after changing subject line to "nvmem: brcm_nvram: check for
allocation failure"
--srini
> drivers/nvmem/brcm_nvram.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c
> index 439f00b9eef6..c80af8a31eba 100644
> --- a/drivers/nvmem/brcm_nvram.c
> +++ b/drivers/nvmem/brcm_nvram.c
> @@ -95,6 +95,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;
> memcpy_fromio(data, priv->base, len);
> data[len - 1] = '\0';
>
Powered by blists - more mailing lists