diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-14 15:17:35 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-14 15:17:35 -0300 |
commit | 4c27c478d1937514e9fa46eb617a3f68b5539d34 (patch) | |
tree | 84f578714dc7a1be6ee0bc2852687171d10f001f /linux/drivers | |
parent | e54bc97df6d51a83c65d22e20e600459e4d717f9 (diff) | |
download | mediapointer-dvb-s2-4c27c478d1937514e9fa46eb617a3f68b5539d34.tar.gz mediapointer-dvb-s2-4c27c478d1937514e9fa46eb617a3f68b5539d34.tar.bz2 |
Fix a bug on device detection
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Thanks to Thierry MERLE <thierry.merle@free.fr> for pointing this
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-cards.c | 1 | ||||
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-cards.h | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-video.c | 4 |
3 files changed, 7 insertions, 0 deletions
diff --git a/linux/drivers/media/video/usbvision/usbvision-cards.c b/linux/drivers/media/video/usbvision/usbvision-cards.c index 849cc5482..30367d734 100644 --- a/linux/drivers/media/video/usbvision/usbvision-cards.c +++ b/linux/drivers/media/video/usbvision/usbvision-cards.c @@ -1028,6 +1028,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { .ModelString = "Hauppauge WinTv-USB", }, }; +const int usbvision_device_data_size=ARRAY_SIZE(usbvision_device_data); /* Supported Devices */ diff --git a/linux/drivers/media/video/usbvision/usbvision-cards.h b/linux/drivers/media/video/usbvision/usbvision-cards.h index 37d619b1e..766accc92 100644 --- a/linux/drivers/media/video/usbvision/usbvision-cards.h +++ b/linux/drivers/media/video/usbvision/usbvision-cards.h @@ -63,3 +63,5 @@ #define PINNA_LINX_VD_IN_CAB_PAL 62 #define PINNA_PCTV_BUNGEE_PAL_FM 63 #define HPG_WINTV 64 + +extern const int usbvision_device_data_size; diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 925d1352a..ca51f0670 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -1961,6 +1961,10 @@ static int __devinit usbvision_probe(struct usb_interface *intf, dev->descriptor.idProduct, ifnum); 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__, usbvision_device_data[model].ModelString); |