public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: n179911 <n179911@gmail.com>, linux-media@vger.kernel.org
Subject: Re: Question about implementation of __qbuf_dmabuf() in videobuf2-core.c
Date: Wed, 23 Apr 2014 09:24:52 +0200	[thread overview]
Message-ID: <53576AC4.8090303@xs4all.nl> (raw)
In-Reply-To: <CAKZjMP3B5k8MByhVrn=vsWOwnZLDL+YS48VvAWQ+z4=RKduV-Q@mail.gmail.com>

On 04/23/2014 02:18 AM, n179911 wrote:
> In __qbuf_dmabuf(), it check the length and size of the buffer being
> queued, like this:
> http://lxr.free-electrons.com/source/drivers/media/v4l2-core/videobuf2-core.c#L1158
> 
> My question is why the range check is liked this:
> 
> 1158  if (planes[plane].length < planes[plane].data_offset +
> 1159                     q->plane_sizes[plane]) {

It's a bug. It should be:

	if (planes[plane].length < q->plane_sizes[plane]) {

This has been fixed in our upstream code and will appear in 3.16.

Regards,

	Hans

>         .....
> 
> Isn't  planes[plane].length + planes[plane].data_offset equals to
> q->plane_sizes[plane]?
> 
> So the check should be?
>  if (planes[plane].length < q->plane_sizes[plane] - planes[plane].data_offset)
> 
> Please tell me what am I missing?
> 
> Thank you
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2014-04-23  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23  0:18 Question about implementation of __qbuf_dmabuf() in videobuf2-core.c n179911
2014-04-23  7:24 ` Hans Verkuil [this message]
2014-04-29 17:27   ` n179911
2014-05-05 10:19     ` Hans Verkuil

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=53576AC4.8090303@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=n179911@gmail.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