[PATCH] Re: drivers/media/video/bt819.c: bt819_init: wrong array indexing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-03-23 at 01:38, Adrian Bunk wrote:
> The Coverity checker found the following bug in array indexing in the 
> function bt819_init in drivers/media/video/bt819.c:
> 
>         init[0x19*2-1] = decoder->norm == 0 ? 115 : 93;
> 
> I don't know whether the other array indexes in this function are 
> correct, but this is definitely wrong:
> It indexes element 49 wile only the elements 0-43 are available.

Auch, that is kinda embarrassing... Attached patch fixes it. Andrew, can
you please put this patch in the kernel?

Signed-off-by: Ronald S. Bultje <[email protected]>

Ronald

-- 
Ronald S. Bultje <[email protected]>
Index: bt819.c
===================================================================
RCS file: /cvsroot/mjpeg/driver-zoran/bt819.c,v
retrieving revision 1.6
diff -u -r1.6 bt819.c
--- bt819.c	16 Sep 2004 22:53:26 -0000	1.6
+++ bt819.c	23 Mar 2005 09:04:52 -0000
@@ -239,7 +239,8 @@
 	init[0x07 * 2 - 1] = timing->hactive & 0xff;
 	init[0x08 * 2 - 1] = timing->hscale >> 8;
 	init[0x09 * 2 - 1] = timing->hscale & 0xff;
-	init[0x19*2-1] = decoder->norm == 0 ? 115 : 93;	/* Chroma burst delay */
+	/* 0x15 in array is address 0x19 */
+	init[0x15 * 2 - 1] = (decoder->norm == 0) ? 115 : 93;	/* Chroma burst delay */
 	/* reset */
 	bt819_write(client, 0x1f, 0x00);
 	mdelay(1);

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux