Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbWJEPUJ (ORCPT ); Thu, 5 Oct 2006 11:20:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751503AbWJEPUI (ORCPT ); Thu, 5 Oct 2006 11:20:08 -0400 Received: from xenotime.net ([66.160.160.81]:15028 "HELO xenotime.net") by vger.kernel.org with SMTP id S932114AbWJEPUG (ORCPT ); Thu, 5 Oct 2006 11:20:06 -0400 Date: Thu, 5 Oct 2006 08:21:31 -0700 From: Randy Dunlap To: Eric Sesterhenn Cc: linux-kernel@vger.kernel.org, netwiz@crc.id.au Subject: Re: [Patch] Dereference in drivers/usb/misc/adutux.c Message-Id: <20061005082131.c9a0ecd0.rdunlap@xenotime.net> In-Reply-To: <1160042489.3101.2.camel@alice> References: <1160042489.3101.2.camel@alice> Organization: YPO4 X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1000 Lines: 33 On Thu, 05 Oct 2006 12:01:29 +0200 Eric Sesterhenn wrote: > hi, > > in two of the error cases, dev is still NULL, > and we dereference it. Spotted by coverity (cid#1428, 1429) > > Signed-off-by: Eric Sesterhenn > > --- linux-2.6.19-rc1/drivers/usb/misc/adutux.c.orig 2006-10-05 11:57:52.000000000 +0200 > +++ linux-2.6.19-rc1/drivers/usb/misc/adutux.c 2006-10-05 11:58:19.000000000 +0200 > @@ -370,7 +370,8 @@ static int adu_release(struct inode *ino > retval = adu_release_internal(dev); > > exit: > - up(&dev->sem); > + if(dev) > + up(&dev->sem); > dbg(2," %s : leave, return value %d", __FUNCTION__, retval); > return retval; > } if (dev) space after if, for, while, etc. No space after function names. --- ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/