Commit f8a389db authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (5518): Fix a bug on device detection

Thanks to: Thierry MERLE <thierry.merle@free.fr> for pointing this
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent c682b3a7
...@@ -1027,6 +1027,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { ...@@ -1027,6 +1027,7 @@ struct usbvision_device_data_st usbvision_device_data[] = {
.ModelString = "Hauppauge WinTv-USB", .ModelString = "Hauppauge WinTv-USB",
}, },
}; };
const int usbvision_device_data_size=ARRAY_SIZE(usbvision_device_data);
/* Supported Devices */ /* Supported Devices */
......
...@@ -63,3 +63,5 @@ ...@@ -63,3 +63,5 @@
#define PINNA_LINX_VD_IN_CAB_PAL 62 #define PINNA_LINX_VD_IN_CAB_PAL 62
#define PINNA_PCTV_BUNGEE_PAL_FM 63 #define PINNA_PCTV_BUNGEE_PAL_FM 63
#define HPG_WINTV 64 #define HPG_WINTV 64
extern const int usbvision_device_data_size;
...@@ -1792,6 +1792,10 @@ static int __devinit usbvision_probe(struct usb_interface *intf, ...@@ -1792,6 +1792,10 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
dev->descriptor.idProduct, ifnum); dev->descriptor.idProduct, ifnum);
model = devid->driver_info; model = devid->driver_info;
if ( (model<0) || (model>=usbvision_device_data_size) ) {
printk(KERN_INFO "model out of bounds %d\n",model);
return -ENODEV;
}
printk(KERN_INFO "%s: %s found\n", __FUNCTION__, printk(KERN_INFO "%s: %s found\n", __FUNCTION__,
usbvision_device_data[model].ModelString); usbvision_device_data[model].ModelString);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment