public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Dereference in drivers/usb/misc/adutux.c
@ 2006-10-05 10:01 Eric Sesterhenn
  2006-10-05 15:21 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sesterhenn @ 2006-10-05 10:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: netwiz

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 <snakebyte@gmx.de>

--- 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;
 }



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Dereference in drivers/usb/misc/adutux.c
  2006-10-05 10:01 [Patch] Dereference in drivers/usb/misc/adutux.c Eric Sesterhenn
@ 2006-10-05 15:21 ` Randy Dunlap
  2006-10-05 22:09   ` Eric Sesterhenn
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2006-10-05 15:21 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel, netwiz

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 <snakebyte@gmx.de>
> 
> --- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Dereference in drivers/usb/misc/adutux.c
  2006-10-05 15:21 ` Randy Dunlap
@ 2006-10-05 22:09   ` Eric Sesterhenn
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sesterhenn @ 2006-10-05 22:09 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel, netwiz

hi,

> > in two of the error cases, dev is still NULL,
> > and we dereference it. Spotted by coverity (cid#1428, 1429)
> > 
> space after if, for, while, etc.  No space after function names.

updated patch below.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.19-rc1/drivers/usb/misc/adutux.c.orig	2006-10-05 17:34:45.000000000 +0200
+++ linux-2.6.19-rc1/drivers/usb/misc/adutux.c	2006-10-05 17:34:53.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;
 }



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-05 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-05 10:01 [Patch] Dereference in drivers/usb/misc/adutux.c Eric Sesterhenn
2006-10-05 15:21 ` Randy Dunlap
2006-10-05 22:09   ` Eric Sesterhenn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox