mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* array subscript out of range
@ 2005-06-28  9:12 d binderman
  2005-06-28 10:56 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: d binderman @ 2005-06-28  9:12 UTC (permalink / raw)
  To: linux-kernel

Hello there,

I just tried to compile the Linux Kernel version 2.6.11.12
with the most excellent Intel C compiler. It said

drivers/media/video/bt819.c(239): warning #175: subscript out of range
    init[0x19*2-1] = decoder->norm == 0 ? 115 : 93; /* Chroma burst delay */
        ^

This is clearly broken code, since the init data is declared
with 44 elements, but the index is for number 49.

Suggest code rework.

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: array subscript out of range
  2005-06-28  9:12 array subscript out of range d binderman
@ 2005-06-28 10:56 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-06-28 10:56 UTC (permalink / raw)
  To: d binderman; +Cc: linux-kernel

"d binderman" <dcb314@hotmail.com> wrote:
>
> Hello there,
> 
> I just tried to compile the Linux Kernel version 2.6.11.12
> with the most excellent Intel C compiler. It said
> 
> drivers/media/video/bt819.c(239): warning #175: subscript out of range
>     init[0x19*2-1] = decoder->norm == 0 ? 115 : 93; /* Chroma burst delay */
>         ^
> 
> This is clearly broken code, since the init data is declared
> with 44 elements, but the index is for number 49.
> 
> Suggest code rework.

Was fixed.


From: "Ronald S. Bultje" <rbultje@ronald.bitfreak.net>

Signed-off-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/media/video/bt819.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/media/video/bt819.c~bt819-array-indexing-fix drivers/media/video/bt819.c
--- 25/drivers/media/video/bt819.c~bt819-array-indexing-fix	2005-03-28 14:21:43.000000000 -0800
+++ 25-akpm/drivers/media/video/bt819.c	2005-03-28 14:21:44.000000000 -0800
@@ -236,7 +236,8 @@ bt819_init (struct i2c_client *client)
 	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-06-28 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-28  9:12 array subscript out of range d binderman
2005-06-28 10:56 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®