ALSA: usb: fixing out-of-bound array read
Sajan Karumanchi [Tue, 28 Apr 2015 14:23:08 +0000 (19:23 +0530)]
Fixing usb_nonswitch_ids out-of-bound array read.

Coverity ID: 29943

Bug 200083369

Change-Id: I7553a486435277fc3ccda49a2092d45c92d2df51
Signed-off-by: Sajan Karumanchi <skarumanchi@nvidia.com>
Reviewed-on: http://git-master/r/736775
(cherry picked from commit bb0441f04150076f04fa742083e99837e39ec839)
Reviewed-on: http://git-master/r/767478
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sanket Parmar <sparmer@nvidia.com>
Tested-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>

sound/usb/card.c

index 11dcee5..6a33557 100644 (file)
@@ -782,7 +782,7 @@ static struct usb_device_id usb_nonswitch_ids[] = {
 static int usb_nonswitch_match(struct usb_device *udev)
 {
        int i;
-       for (i = 0; i < sizeof(usb_nonswitch_ids); i++) {
+       for (i = 0; i < ARRAY_SIZE(usb_nonswitch_ids); i++) {
                if (
                (usb_nonswitch_ids[i].idVendor == udev->descriptor.idVendor) &&
                (usb_nonswitch_ids[i].idProduct == udev->descriptor.idProduct))