* drivers/media/video/bt819.c: bt819_init: wrong array indexing
@ 2005-03-23 0:38 Adrian Bunk
2005-03-23 9:07 ` [PATCH] " Ronald S. Bultje
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2005-03-23 0:38 UTC (permalink / raw)
To: kraxel; +Cc: video4linux-list, linux-kernel
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.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] Re: drivers/media/video/bt819.c: bt819_init: wrong array indexing
2005-03-23 0:38 drivers/media/video/bt819.c: bt819_init: wrong array indexing Adrian Bunk
@ 2005-03-23 9:07 ` Ronald S. Bultje
0 siblings, 0 replies; 2+ messages in thread
From: Ronald S. Bultje @ 2005-03-23 9:07 UTC (permalink / raw)
To: Linux and Kernel Video; +Cc: akpm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 654 bytes --]
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 <rbultje@ronald.bitfreak.net>
Ronald
--
Ronald S. Bultje <rbultje@ronald.bitfreak.net>
[-- Attachment #2: d --]
[-- Type: text/x-patch, Size: 672 bytes --]
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-23 9:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-23 0:38 drivers/media/video/bt819.c: bt819_init: wrong array indexing Adrian Bunk
2005-03-23 9:07 ` [PATCH] " Ronald S. Bultje
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox