LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Julia Lawall <julia@diku.dk>
Cc: linuxppc-dev@ozlabs.org,
	Johannes Berg <johannes@sipsolutions.net>,
	kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] sound/aoa: Add kmalloc NULL tests
Date: Fri, 31 Jul 2009 10:16:46 +0200	[thread overview]
Message-ID: <s5hljm5i7wx.wl%tiwai@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0907310831330.13462@ask.diku.dk>

At Fri, 31 Jul 2009 08:32:03 +0200 (CEST),
Julia Lawall wrote:
> 
> From: Julia Lawall <julia@diku.dk>
> 
> Check that the result of kzalloc is not NULL before a dereference.
> 
> The semantic match that finds this problem is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
> 
> // <smpl>
> @@
> expression *x;
> identifier f;
> constant char *C;
> @@
> 
> x = \(kmalloc\|kcalloc\|kzalloc\)(...);
> ... when != x == NULL
>     when != x != NULL
>     when != (x || ...)
> (
> kfree(x)
> |
> f(...,C,...,x,...)
> |
> *f(...,x,...)
> |
> *x->f
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied now.
But, please fix the path of the file correctly applicable to linux
kernel tree at the next time.  It includes /var/x/y, and confuses git
am totally.

thanks,

Takashi

> 
> ---
>  sound/aoa/core/gpio-pmf.c           |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/var/linuxes/linux-next/sound/aoa/core/gpio-pmf.c b/var/julia/linuxcopy/sound/aoa/core/gpio-pmf.c
> index 5ca2220..1dd0c28 100644
> --- a/var/linuxes/linux-next/sound/aoa/core/gpio-pmf.c
> +++ b/var/julia/linuxcopy/sound/aoa/core/gpio-pmf.c
> @@ -182,6 +182,10 @@ static int pmf_set_notify(struct gpio_runtime *rt,
>  	if (!old && notify) {
>  		irq_client = kzalloc(sizeof(struct pmf_irq_client),
>  				     GFP_KERNEL);
> +		if (!irq_client) {
> +			err = -ENOMEM;
> +			goto out_unlock;
> +		}
>  		irq_client->data = notif;
>  		irq_client->handler = pmf_handle_notify_irq;
>  		irq_client->owner = THIS_MODULE;
> 

      reply	other threads:[~2009-07-31  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30 14:11 [PATCH 5/5] sound/aoa: Add kmalloc NULL tests Julia Lawall
2009-07-30 14:17 ` Johannes Berg
2009-07-30 14:29   ` Julia Lawall
2009-07-31  6:22     ` Takashi Iwai
2009-07-31  6:31       ` Julia Lawall
2009-07-31  6:32       ` Julia Lawall
2009-07-31  8:16         ` Takashi Iwai [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=s5hljm5i7wx.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=johannes@sipsolutions.net \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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