]> err.no Git - linux-2.6/commitdiff
[PATCH] USB: fix pointer dereference in drivers/usb/misc/usblcd
authorEric Sesterhenn <snakebyte@gmx.de>
Mon, 26 Jun 2006 22:57:42 +0000 (00:57 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 Jul 2006 23:03:23 +0000 (16:03 -0700)
coverity spotted (id #185) that we still use urb, if the allocation
fails in the error path. This patch fixes this by returning directly.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/usblcd.c

index c82c402285a0d42ced463dcd87084ca5f4d540cf..e095772dd8e9eebc2887afc835b105d72af09d03 100644 (file)
@@ -200,10 +200,8 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz
 
        /* create a urb, and a buffer for it, and copy the data to the urb */
        urb = usb_alloc_urb(0, GFP_KERNEL);
-       if (!urb) {
-               retval = -ENOMEM;
-               goto error;
-       }
+       if (!urb)
+               return -ENOMEM;
        
        buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma);
        if (!buf) {