public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/usb/misc/cypress_cy7c63.c: NULL dereference
@ 2006-08-15  0:04 Adrian Bunk
  2006-08-15  0:57 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2006-08-15  0:04 UTC (permalink / raw)
  To: o.bock, gregkh; +Cc: linux-usb-devel, linux-kernel

The Coverity Checker spotted the following obvious NULL dereference:

<--  snip  -->

...
static int cypress_probe(struct usb_interface *interface,
                         const struct usb_device_id *id)
{
...
        if (dev == NULL) {
                dev_err(&dev->udev->dev, "Out of memory!\n");
                goto error;
        }
...
}
...

<--  snip  -->

cu
Adrian

-- 

    Gentoo kernels are 42 times more popular than SUSE kernels among
    KLive users  (a service by SUSE contractor Andrea Arcangeli that
    gathers data about kernels from many users worldwide).

       There are three kinds of lies: Lies, Damn Lies, and Statistics.
                                                    Benjamin Disraeli


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

* Re: drivers/usb/misc/cypress_cy7c63.c: NULL dereference
  2006-08-15  0:04 drivers/usb/misc/cypress_cy7c63.c: NULL dereference Adrian Bunk
@ 2006-08-15  0:57 ` Greg KH
  2006-08-16 20:51   ` Oliver Bock
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2006-08-15  0:57 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: o.bock, linux-usb-devel, linux-kernel

On Tue, Aug 15, 2006 at 02:04:42AM +0200, Adrian Bunk wrote:
> The Coverity Checker spotted the following obvious NULL dereference:
> 
> <--  snip  -->
> 
> ...
> static int cypress_probe(struct usb_interface *interface,
>                          const struct usb_device_id *id)
> {
> ...
>         if (dev == NULL) {
>                 dev_err(&dev->udev->dev, "Out of memory!\n");
>                 goto error;
>         }
> ...
> }
> ...
> 
> <--  snip  -->

Thanks for letting me know, the patch below should fix this.

greg k-h

------------

From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: USB: fix bug in cypress_cy7c63.c driver

This was pointed out by Adrian Bunk <bunk@stusta.de>, as found by the
Coverity Checker.


Cc: Adrian Bunk <bunk@stusta.de>
Cc: Oliver Bock <o.bock@fh-wolfenbuettel.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/misc/cypress_cy7c63.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- gregkh-2.6.orig/drivers/usb/misc/cypress_cy7c63.c
+++ gregkh-2.6/drivers/usb/misc/cypress_cy7c63.c
@@ -208,7 +208,7 @@ static int cypress_probe(struct usb_inte
 	/* allocate memory for our device state and initialize it */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (dev == NULL) {
-		dev_err(&dev->udev->dev, "Out of memory!\n");
+		dev_err(&interface->dev, "Out of memory!\n");
 		goto error;
 	}
 

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

* Re: drivers/usb/misc/cypress_cy7c63.c: NULL dereference
  2006-08-15  0:57 ` Greg KH
@ 2006-08-16 20:51   ` Oliver Bock
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Bock @ 2006-08-16 20:51 UTC (permalink / raw)
  To: Greg KH; +Cc: Adrian Bunk, linux-usb-devel, linux-kernel

Thanks guys!
Sorry for that blunder...

Oliver

On Tuesday 15 August 2006 02:57, Greg KH wrote:
> On Tue, Aug 15, 2006 at 02:04:42AM +0200, Adrian Bunk wrote:
> > The Coverity Checker spotted the following obvious NULL dereference:
> >
> > <--  snip  -->
> >
> > ...
> > static int cypress_probe(struct usb_interface *interface,
> >                          const struct usb_device_id *id)
> > {
> > ...
> >         if (dev == NULL) {
> >                 dev_err(&dev->udev->dev, "Out of memory!\n");
> >                 goto error;
> >         }
> > ...
> > }
> > ...
> >
> > <--  snip  -->
>
> Thanks for letting me know, the patch below should fix this.
>
> greg k-h
>
> ------------
>
> From: Greg Kroah-Hartman <gregkh@suse.de>
> Subject: USB: fix bug in cypress_cy7c63.c driver
>
> This was pointed out by Adrian Bunk <bunk@stusta.de>, as found by the
> Coverity Checker.
>
>
> Cc: Adrian Bunk <bunk@stusta.de>
> Cc: Oliver Bock <o.bock@fh-wolfenbuettel.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> ---
>  drivers/usb/misc/cypress_cy7c63.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- gregkh-2.6.orig/drivers/usb/misc/cypress_cy7c63.c
> +++ gregkh-2.6/drivers/usb/misc/cypress_cy7c63.c
> @@ -208,7 +208,7 @@ static int cypress_probe(struct usb_inte
>  	/* allocate memory for our device state and initialize it */
>  	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
>  	if (dev == NULL) {
> -		dev_err(&dev->udev->dev, "Out of memory!\n");
> +		dev_err(&interface->dev, "Out of memory!\n");
>  		goto error;
>  	}

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

end of thread, other threads:[~2006-08-16 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-15  0:04 drivers/usb/misc/cypress_cy7c63.c: NULL dereference Adrian Bunk
2006-08-15  0:57 ` Greg KH
2006-08-16 20:51   ` Oliver Bock

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