mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "d binderman" <dcb314@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: array subscript out of range
Date: Tue, 28 Jun 2005 03:56:38 -0700	[thread overview]
Message-ID: <20050628035638.41fd4004.akpm@osdl.org> (raw)
In-Reply-To: <BAY19-F255ACFD14A7CB3309260039CE10@phx.gbl>

"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);
_


      reply	other threads:[~2005-06-28 11:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-28  9:12 d binderman
2005-06-28 10:56 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050628035638.41fd4004.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dcb314@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®