Skip to contentSkip to conversation

Pointer dereference in drivers/usb/misc/usblcd

PATCH New Eric Sesterhenn 1 participant 1 message Jun 26, 2006 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Pointer dereference in drivers/usb/misc/usblcd

hi,

coverity spotted (id #185) that we still use urb, if the allocation fails in the error path. This patch fixes this by returning directly.

drivers/usb/misc/usblcd.c renamed from drivers/usb/misc/usblcd.c.orig +2 -4
@@ -200,10 +200,8 @@ static ssize_t lcd_write(struct file *fi
 
 	/* 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) {