All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: kernel-janitors@vger.kernel.org,
	Anton Vorontsov <cbouatmailru@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: gpio-charger: fix potential NULL dereference
Date: Fri, 19 Nov 2010 19:01:56 +0000	[thread overview]
Message-ID: <4CE6C9A4.4090307@metafoo.de> (raw)
In-Reply-To: <1290192114-11659-1-git-send-email-segoon@openwall.com>

Vasiliy Kulikov wrote:
> kzalloc() result is not compared with NULL.  It might lead to NULL
> pointer dereference in OOM situation.
> 
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
>  Compile tested only.
> 
>  drivers/power/gpio-charger.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
> index fccbe99..b07a71c 100644
> --- a/drivers/power/gpio-charger.c
> +++ b/drivers/power/gpio-charger.c
> @@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
>  	}
>  
>  	gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
> +	if (!gpio_charger) {
> +		dev_err(&pdev->dev, "kzalloc failed\n");
> +		return -ENOMEM;
> +	}
>  
>  	charger = &gpio_charger->charger;
>  

Hi

I already send a similar patch yesterday.
See http://lkml.org/lkml/2010/11/18/632

- Lars

WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: kernel-janitors@vger.kernel.org,
	Anton Vorontsov <cbouatmailru@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: gpio-charger: fix potential NULL dereference
Date: Fri, 19 Nov 2010 20:01:56 +0100	[thread overview]
Message-ID: <4CE6C9A4.4090307@metafoo.de> (raw)
In-Reply-To: <1290192114-11659-1-git-send-email-segoon@openwall.com>

Vasiliy Kulikov wrote:
> kzalloc() result is not compared with NULL.  It might lead to NULL
> pointer dereference in OOM situation.
> 
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
>  Compile tested only.
> 
>  drivers/power/gpio-charger.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
> index fccbe99..b07a71c 100644
> --- a/drivers/power/gpio-charger.c
> +++ b/drivers/power/gpio-charger.c
> @@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
>  	}
>  
>  	gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
> +	if (!gpio_charger) {
> +		dev_err(&pdev->dev, "kzalloc failed\n");
> +		return -ENOMEM;
> +	}
>  
>  	charger = &gpio_charger->charger;
>  

Hi

I already send a similar patch yesterday.
See http://lkml.org/lkml/2010/11/18/632

- Lars

  reply	other threads:[~2010-11-19 19:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19 18:41 [PATCH] power: gpio-charger: fix potential NULL dereference Vasiliy Kulikov
2010-11-19 18:41 ` Vasiliy Kulikov
2010-11-19 19:01 ` Lars-Peter Clausen [this message]
2010-11-19 19:01   ` Lars-Peter Clausen
2010-11-26 17:06 ` Vasiliy Kulikov
2010-11-26 17:06   ` Vasiliy Kulikov

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=4CE6C9A4.4090307@metafoo.de \
    --to=lars@metafoo.de \
    --cc=cbouatmailru@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=segoon@openwall.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.