RE: [PATCH] media: vb2: add a check for uninitialized buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Wednesday, October 19, 2011 8:03 AM Pawel Osciak wrote:

> Hi Marek,
> I think there is a typo in this patch:
> 
> On Wed, Oct 12, 2011 at 09:12, Marek Szyprowski
> <m.szyprowski@xxxxxxxxxxx> wrote:
> > __buffer_in_use() might be called for empty/uninitialized buffer in the
> > following scenario: REQBUF(n, USER_PTR), QUERYBUF(). This patch fixes
> > kernel ops in such case.
> >
> > Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> > CC: Pawel Osciak <pawel@xxxxxxxxxx>
> >
> > ---
> >  drivers/media/video/videobuf2-core.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
> > index d8affb8..cdbbab7 100644
> > --- a/drivers/media/video/videobuf2-core.c
> > +++ b/drivers/media/video/videobuf2-core.c
> > @@ -284,14 +284,14 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer
> *vb)
> >  {
> >        unsigned int plane;
> >        for (plane = 0; plane < vb->num_planes; ++plane) {
> > +               void mem_priv = vb->planes[plane].mem_priv;
> 
> Shouldn't this be void * instead of just void?

Yes, it should be. It looks that I've posted an older version. In the pull 
request there is a correct version.

> >                /*
> >                 * If num_users() has not been provided, call_memop
> >                 * will return 0, apparently nobody cares about this
> >                 * case anyway. If num_users() returns more than 1,
> >                 * we are not the only user of the plane's memory.
> >                 */
> > -               if (call_memop(q, plane, num_users,
> > -                               vb->planes[plane].mem_priv) > 1)
> > +               if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 1)
> >                        return true;
> >        }
> >        return false;
> > --
> > 1.7.1.569.g6f426

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux