blob: d4c86c4c4ddd35fa361a4c3c52fa05dde36047b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
From linux-kernel-owner+greg=40kroah.com-S933309AbWFZW6V@vger.kernel.org Mon Jun 26 16:19:13 2006
From: Eric Sesterhenn <snakebyte@gmx.de>
Subject: USB: fix pointer dereference in drivers/usb/misc/usblcd
Cc: <g.toth@e-biz.lu>
Date: Tue, 27 Jun 2006 00:57:42 +0200
Message-Id: <1151362662.15204.7.camel@alice>
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 | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- gregkh-2.6.orig/drivers/usb/misc/usblcd.c
+++ gregkh-2.6/drivers/usb/misc/usblcd.c
@@ -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) {
|