Skip to content

Commit

Permalink
USB: wusb: correctly check size of security descriptor.
Browse files Browse the repository at this point in the history
Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
David Vrabel authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent 2e9729d commit 9279095
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/wusbcore/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
const void *itr, *top;
char buf[64];

secd = kmalloc(sizeof(struct usb_security_descriptor), GFP_KERNEL);
secd = kmalloc(sizeof(*secd), GFP_KERNEL);
if (secd == NULL) {
result = -ENOMEM;
goto out;
}

result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
0, secd, sizeof(struct usb_security_descriptor));
if (result < sizeof(secd)) {
0, secd, sizeof(*secd));
if (result < sizeof(*secd)) {
dev_err(dev, "Can't read security descriptor or "
"not enough data: %d\n", result);
goto out;
Expand Down

0 comments on commit 9279095

Please sign in to comment.