2006-08-14 23:23:38

by Adrian Bunk

[permalink] [raw]
Subject: drivers/media/video/bt866.c: array overflows

The Coverity checker spotted the following two array overflows:


<-- snip -->

...
struct bt866 {
...
unsigned char reg[128];
...
}
...
static int bt866_do_command(struct bt866 *encoder,
unsigned int cmd, void *arg)
{
...
val = encoder->reg[0xdc];
...
bt866_write(encoder, 0xdc, val);
...
}
...
static int bt866_write(struct bt866 *encoder,
unsigned char subaddr, unsigned char data)
{
...
encoder->reg[subaddr] = data;
...
}
...

<-- snip -->


The two bugs are obvious:
0xdc = 220 >= 128


cu
Adrian

--

Gentoo kernels are 42 times more popular than SUSE kernels among
KLive users (a service by SUSE contractor Andrea Arcangeli that
gathers data about kernels from many users worldwide).

There are three kinds of lies: Lies, Damn Lies, and Statistics.
Benjamin Disraeli


2006-08-15 06:10:27

by Martin Samuelsson

[permalink] [raw]
Subject: Re: drivers/media/video/bt866.c: array overflows

On Tue, 15 Aug 2006 01:23:37 +0200
Adrian Bunk <[email protected]> wrote:

> The Coverity checker spotted the following two array overflows:

Nice coverity checker! *pat pat*

Now, a question: Where can I find the latest version of the files that concern the avs6eyes driver? In april, I got this mail that informed me that the avs6eyes driver patch had been removed from the -mm tree. I figured that it was removed because of the lack of internal V4L2 support when V4L1 was about to be chucked out from the kernel. I looked around a little to see if I could find the driver, but I couldn't.

Obviously, as you've found bugs in it, I didn't look in the right places. Where, pray tell, did the little critter go?

Getting a new job and moving to another city has hampered me in my efforts to work on the driver, that's why I've been so quiet.

> The two bugs are obvious:
> 0xdc = 220 >= 128

Gotta fix that. Good work.

/Sam

2006-08-15 18:13:23

by Adrian Bunk

[permalink] [raw]
Subject: Re: drivers/media/video/bt866.c: array overflows

On Tue, Aug 15, 2006 at 08:06:18AM +0200, Martin Samuelsson wrote:
> On Tue, 15 Aug 2006 01:23:37 +0200
> Adrian Bunk <[email protected]> wrote:
>
> > The Coverity checker spotted the following two array overflows:
>
> Nice coverity checker! *pat pat*
>
> Now, a question: Where can I find the latest version of the files that concern the avs6eyes driver? In april, I got this mail that informed me that the avs6eyes driver patch had been removed from the -mm tree. I figured that it was removed because of the lack of internal V4L2 support when V4L1 was about to be chucked out from the kernel. I looked around a little to see if I could find the driver, but I couldn't.
>
> Obviously, as you've found bugs in it, I didn't look in the right places. Where, pray tell, did the little critter go?
>...

It's in 2.6.18-rc4.

> /Sam

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

2006-08-15 21:08:56

by Martin Samuelsson

[permalink] [raw]
Subject: Re: drivers/media/video/bt866.c: array overflows

On Tue, 15 Aug 2006 20:13:20 +0200
Adrian Bunk <[email protected]> wrote:

> On Tue, Aug 15, 2006 at 08:06:18AM +0200, Martin Samuelsson wrote:
> > Obviously, as you've found bugs in it, I didn't look in the right places. Where, pray tell, did the little critter go?
> >...
>
> It's in 2.6.18-rc4.

Nice, it hid in Linus' tree for a while, then. Compiling it now.

Thanks!

/Sam