From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755110AbYKOSJi (ORCPT ); Sat, 15 Nov 2008 13:09:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751822AbYKOSJ3 (ORCPT ); Sat, 15 Nov 2008 13:09:29 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45506 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbYKOSJ2 (ORCPT ); Sat, 15 Nov 2008 13:09:28 -0500 Date: Sat, 15 Nov 2008 19:09:26 +0100 Message-ID: From: Takashi Iwai To: Julia Lawall Cc: perex@perex.cz, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 3/3, repost] sound/pci/pcxhr/pcxhr.c: introduce missing kfree and pci_disable_device In-Reply-To: References: User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.3 (x86_64-suse-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Fri, 14 Nov 2008 19:08:18 +0100 (CET), Julia Lawall wrote: > > From: Julia Lawall > > Error handling code following a kzalloc should free the allocated data. > The error handling code is adjusted to call pci_disable_device(pci); as > well, as done later in the function > > The semantic match that finds the problem is as follows: > (http://www.emn.fr/x-info/coccinelle/) > > // > @r exists@ > local idexpression x; > statement S; > expression E; > identifier f,l; > position p1,p2; > expression *ptr != NULL; > @@ > > ( > if ((x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...)) == NULL) S > | > x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); > ... > if (x == NULL) S > ) > <... when != x > when != if (...) { <+...x...+> } > x->f = E > ...> > ( > return \(0\|<+...x...+>\|ptr\); > | > return@p2 ...; > ) > > @script:python@ > p1 << r.p1; > p2 << r.p2; > @@ > > print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line) > // > > Signed-off-by: Julia Lawall Applied now. Thanks. Takashi