[linux-dvb] [RFC-final] videobuf tree

Mauro Carvalho Chehab mchehab at infradead.org
Sun Oct 7 14:09:02 CEST 2007

Hi Michael,
Em Dom, 2007-10-07 às 02:30 -0400, Michael Krufky escreveu:
> Mauro Carvalho Chehab wrote:
> > Hi Michael,
> > 
> > Please try the enclosed patch. It is just a hack. 
> > 
> > Please, post the dmesg, working or not.
> Mauro,
> Your patch touches code that apparently is not being executed in this case.  I've enclosed dmesg anyway (see attached)

I took a look at cx23885 code. It seems that there's a serious error on
the way you're using cx23885_buffer there:

cx23885-dvb.c:  return cx23885_buf_prepare(q, port, (struct
cx23885_buffer*)vb, field);
cx23885-dvb.c:  cx23885_buf_queue(port, (struct cx23885_buffer*)vb);
cx23885-dvb.c:  cx23885_free_buffer(q, (struct cx23885_buffer*)vb);

It seems that you are forcing videobuf_buffer to be cx23885_buffer. This
is not right!

This is what is defined on cx23885.h:

struct cx23885_buffer {
        /* common v4l buffer stuff -- must be first */
        struct videobuf_buffer vb;

        /* cx23885 specific */
        unsigned int           bpl;
        struct btcx_riscmem    risc;
        struct cx23885_fmt     *fmt;
        u32                    count;

You should notice that cx23885_buffer size is bigger than
videobuf_buffer. If you just force one to be equal to the other, you'll
use more memory than the allocated one! 

Also, videobuf code will also add some extra bytes at the alloced memory
for its own consuption.

The new videobuf code has some magic to protect about this bad usage,
otherwise, you may risk to corrupt other memory areas with dma
transfers. I lost part of my reiserfs btrees once, with a bad code like

What it should be done, is to use the allocated area provided by

I dunno how this ever worked!


More information about the linux-dvb mailing list