mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: dan.j.williams@intel.com, linux-nvdimm@lists.01.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] libnvdimm, btt: check memory allocation failure
Date: Tue, 29 Aug 2017 16:50:06 -0600	[thread overview]
Message-ID: <20170829225006.GB16374@omniknight.lm.intel.com> (raw)
In-Reply-To: <20170827063034.4802-1-christophe.jaillet@wanadoo.fr>

On 08/27, Christophe JAILLET wrote:
> Check memory allocation failures and return -ENOMEM in such cases, as
> already done few lines below for another memory allocation.
> 
> This avoids NULL pointers dereference.
> 
> Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7 format")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/nvdimm/btt.c | 2 ++
>  1 file changed, 2 insertions(+)

Looks good, thank you.
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index 60491641a8d6..607184ebcfbf 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -1431,6 +1431,8 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns)
>  	}
>  
>  	btt_sb = devm_kzalloc(&nd_btt->dev, sizeof(*btt_sb), GFP_KERNEL);
> +	if (!btt_sb)
> +		return -ENOMEM;
>  
>  	/*
>  	 * If this returns < 0, that is ok as it just means there wasn't
> -- 
> 2.11.0
> 

      reply	other threads:[~2017-08-29 22:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27  6:30 Christophe JAILLET
2017-08-29 22:50 ` Vishal Verma [this message]

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=20170829225006.GB16374@omniknight.lm.intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.j.williams@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.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

all inboxes | Powered by JetHome®