From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D9793B7B8B for ; Fri, 31 Jul 2009 18:16:53 +1000 (EST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx2.suse.de", Issuer "CAcert Class 3 Root" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 6898DDDD1B for ; Fri, 31 Jul 2009 18:16:53 +1000 (EST) Date: Fri, 31 Jul 2009 10:16:46 +0200 Message-ID: From: Takashi Iwai To: Julia Lawall Subject: Re: [PATCH 5/5] sound/aoa: Add kmalloc NULL tests In-Reply-To: References: <1248963420.16129.0.camel@johannes.local> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: linuxppc-dev@ozlabs.org, Johannes Berg , kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , At Fri, 31 Jul 2009 08:32:03 +0200 (CEST), Julia Lawall wrote: > > From: Julia Lawall > > 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/) > > // > @@ > 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 > ) > // > > Signed-off-by: Julia Lawall 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; >