aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorHans de Goede <j.w.r.degoede@hhs.nl>2008-07-03 07:15:22 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:16:35 -0400
commit0d2a722ddae5e736a5c36a1b99ee4ca59a8373bc (patch)
tree5c4469e1ba7ace46a133755182750d061c32bcca /drivers/media/video/gspca
parentd646e701819f994c5cb1507dc859b739b5478d32 (diff)
V4L/DVB (8192): Try to fix a reg_w() bug
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/sonixb.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 80911a21e4ae..7850efa41096 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -24,8 +24,8 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) 27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
28static const char version[] = "2.1.0"; 28static const char version[] = "2.1.3";
29 29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); 31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver");
@@ -336,13 +336,22 @@ static void reg_w(struct usb_device *dev,
336 const __u8 *buffer, 336 const __u8 *buffer,
337 __u16 len) 337 __u16 len)
338{ 338{
339 __u8 tmpbuf[32];
340
341#ifdef CONFIG_VIDEO_ADV_DEBUG
342 if (len > sizeof tmpbuf) {
343 PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
344 return;
345 }
346#endif
347 memcpy(tmpbuf, buffer, len);
339 usb_control_msg(dev, 348 usb_control_msg(dev,
340 usb_sndctrlpipe(dev, 0), 349 usb_sndctrlpipe(dev, 0),
341 0x08, /* request */ 350 0x08, /* request */
342 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 351 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
343 value, 352 value,
344 0, /* index */ 353 0, /* index */
345 (__u8 *) buffer, len, 354 tmpbuf, len,
346 500); 355 500);
347} 356}
348 357
@@ -747,22 +756,20 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
747 unsigned char *data, /* isoc packet */ 756 unsigned char *data, /* isoc packet */
748 int len) /* iso packet length */ 757 int len) /* iso packet length */
749{ 758{
750 int p; 759 int i;
751 760
752 if (len > 6 && len < 24) { 761 if (len > 6 && len < 24) {
753 for (p = 0; p < len - 6; p++) { 762 for (i = 0; i < len - 6; i++) {
754 if (data[0 + p] == 0xff 763 if (data[0 + i] == 0xff
755 && data[1 + p] == 0xff 764 && data[1 + i] == 0xff
756 && data[2 + p] == 0x00 765 && data[2 + i] == 0x00
757 && data[3 + p] == 0xc4 766 && data[3 + i] == 0xc4
758 && data[4 + p] == 0xc4 767 && data[4 + i] == 0xc4
759 && data[5 + p] == 0x96) { /* start of frame */ 768 && data[5 + i] == 0x96) { /* start of frame */
760 frame = gspca_frame_add(gspca_dev, 769 frame = gspca_frame_add(gspca_dev, LAST_PACKET,
761 LAST_PACKET, 770 frame, data, 0);
762 frame, 771 data += i + 12;
763 data, 0); 772 len -= i + 12;
764 data += 12;
765 len -= 12;
766 gspca_frame_add(gspca_dev, FIRST_PACKET, 773 gspca_frame_add(gspca_dev, FIRST_PACKET,
767 frame, data, len); 774 frame, data, len);
768 return; 775 return;