From: David Vrabel Date: Mon, 7 Dec 2009 13:50:41 +0000 (+0000) Subject: USB: wusb: correctly check size of security descriptor. X-Git-Tag: v2.6.33-rc1~315^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9279095a9ec191f446372c764413d586c3656214;p=profile%2Fivi%2Fkernel-x86-ivi.git USB: wusb: correctly check size of security descriptor. Reported-by: Roel Kluin Signed-off-by: David Vrabel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c index 4516c36..edcd2d7 100644 --- a/drivers/usb/wusbcore/security.c +++ b/drivers/usb/wusbcore/security.c @@ -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;