drivers/media/video/bt819.c: bt819_init: wrong array indexing
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
Signature · 4 lines
"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 SeedQuoted 8 lines · Adrian Bunk
The Coverity checker found the following bug in array indexing in the function
bt819_initindrivers/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?
Ronald
Signature · 1 line
Ronald S. Bultje <[email protected]>
Index: bt819.c
===================================================================
RCS file: /cvsroot/mjpeg/driver-zoran/bt819.c,v
retrieving revision 1.6
bt819.c +2 -1
@@ -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 );