public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <rafal@milecki.pl>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nvmem: check for allocation failure
Date: Tue, 01 Mar 2022 10:18:58 +0100	[thread overview]
Message-ID: <02cec796f9e50e0895b28c5000ea2254@milecki.pl> (raw)
In-Reply-To: <20220301081127.GC17375@kili>

On 2022-03-01 09: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@oracle.com>

Thank you!

Acked-by: Rafał Miłecki <rafal@milecki.pl>

> ---
>  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';

  reply	other threads:[~2022-03-01 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  8:11 [PATCH] nvmem: check for allocation failure Dan Carpenter
2022-03-01  9:18 ` Rafał Miłecki [this message]
2022-03-01 18:10 ` Christophe JAILLET
2022-04-29  9:33 ` Srinivas Kandagatla
2022-04-29  9:50   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02cec796f9e50e0895b28c5000ea2254@milecki.pl \
    --to=rafal@milecki.pl \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox