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 9358CB7087 for ; Fri, 7 Aug 2009 12:27:11 +1000 (EST) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F00FEDDD01 for ; Fri, 7 Aug 2009 12:27:10 +1000 (EST) Message-Id: From: Kumar Gala To: Julia Lawall In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: [PATCH 1/3] arch/powerpc: Add kmalloc NULL tests Date: Thu, 6 Aug 2009 21:26:59 -0500 References: Cc: kernel-janitors@vger.kernel.org, paulus@samba.org, linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Aug 6, 2009, at 3:04 PM, Julia Lawall wrote: > From: Julia Lawall > > Check that the result of kmalloc/kzalloc is not NULL before > dereferencing it. > > The semantic match that finds this problem is as follows: > (http://coccinelle.lip6.fr/) > > // > @@ > 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 > > --- > arch/powerpc/sysdev/fsl_rio.c | 18 ++++++++++++++---- > 1 files changed, 14 insertions(+), 4 deletions(-) applied to next - k