public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ronald S. Bultje" <rbultje@ronald.bitfreak.net>
To: Linux and Kernel Video <video4linux-list@redhat.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Re: drivers/media/video/bt819.c: bt819_init: wrong array indexing
Date: Wed, 23 Mar 2005 10:07:38 +0100	[thread overview]
Message-ID: <1111568857.547.37.camel@tux.lan> (raw)
In-Reply-To: <20050323003808.GX1948@stusta.de>

[-- 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);

      reply	other threads:[~2005-03-23  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [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=1111568857.547.37.camel@tux.lan \
    --to=rbultje@ronald.bitfreak.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=video4linux-list@redhat.com \
    /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