public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Kiran Padwal <kiran.padwal@smartplayin.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	linux-kernel@vger.kernel.org,
	Kiran Padwal <kiran.padwal21@gmail.com>
Subject: Re: [PATCH] mfd: intel_soc_pmic: Add missing error check for devm_kzalloc
Date: Mon, 16 Feb 2015 12:51:34 +0000	[thread overview]
Message-ID: <20150216125134.GD14545@x1> (raw)
In-Reply-To: <1423649450-11294-1-git-send-email-kiran.padwal@smartplayin.com>

On Wed, 11 Feb 2015, Kiran Padwal wrote:

> This patch add a missing check on the return value of devm_kzalloc,
> which would cause a NULL pointer dereference in a OOM situation.
> 
> Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
> ---
>  drivers/mfd/intel_soc_pmic_core.c |    3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> index df7b064..80cef04 100644
> --- a/drivers/mfd/intel_soc_pmic_core.c
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -64,6 +64,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
>  	config = (struct intel_soc_pmic_config *)id->driver_data;
>  
>  	pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
> +	if (!pmic)
> +		return -ENOMEM;
> +
>  	dev_set_drvdata(dev, pmic);
>  
>  	pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2015-02-16 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 10:10 [PATCH] mfd: intel_soc_pmic: Add missing error check for devm_kzalloc Kiran Padwal
2015-02-16 12:51 ` Lee Jones [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=20150216125134.GD14545@x1 \
    --to=lee.jones@linaro.org \
    --cc=kiran.padwal21@gmail.com \
    --cc=kiran.padwal@smartplayin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /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