summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usblcd.c
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-06-27 00:57:42 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-07-12 16:03:23 -0700
commit053be305d3a5ae0152991f25c6579127fb48710c (patch)
tree236f7e47eff55010f51e2a097b7a409fc81cfd3f /drivers/usb/misc/usblcd.c
parentc1b45f247a2901de3982f33196d5caf8ca5b9799 (diff)
downloadlinux-053be305d3a5ae0152991f25c6579127fb48710c.tar.gz
linux-053be305d3a5ae0152991f25c6579127fb48710c.tar.bz2
linux-053be305d3a5ae0152991f25c6579127fb48710c.zip
[PATCH] USB: fix pointer dereference in drivers/usb/misc/usblcd
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>
Diffstat (limited to 'drivers/usb/misc/usblcd.c')
-rw-r--r--drivers/usb/misc/usblcd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index c82c402285a0..e095772dd8e9 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -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) {