linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Cox <jc@kynesim.co.uk>
To: linux-media@vger.kernel.org
Cc: "Hans Verkuil" <hverkuil@xs4all.nl>
Subject: [PATCH] media: videobuf2: Fix length check for single plane dmabuf queueing
Date: Wed, 17 Jun 2020 14:21:52 +0100	[thread overview]
Message-ID: <gh5kef5bkeel3o6b2dkgc2dfagu9klj4c0@4ax.com> (raw)

Check against length in v4l2_buffer rather than vb2_buffer when the
buffer is a dmabuf. This makes the single plane test the same as the
existing multiplanar test.

Signed-off-by: John Cox <jc@kynesim.co.uk>
---
 drivers/media/common/videobuf2/videobuf2-v4l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index e652f4318284..731c7c99c971 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -114,7 +114,8 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b)
                                return -EINVAL;
                }
        } else {
-               length = (b->memory == VB2_MEMORY_USERPTR)
+               length = (b->memory == VB2_MEMORY_USERPTR ||
+                         b->memory == VB2_MEMORY_DMABUF)
                        ? b->length : vb->planes[0].length;

                if (b->bytesused > length)
--
2.17.1

             reply	other threads:[~2020-06-17 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 13:21 John Cox [this message]
2020-10-08  1:59 ` [PATCH] media: videobuf2: Fix length check for single plane dmabuf queueing Laurent Pinchart
2020-10-16 10:20   ` Dave Stevenson
2020-10-16 12:28     ` Laurent Pinchart
2020-10-16 14:48       ` Dave Stevenson
2020-10-29 10:00         ` Dave Stevenson
2020-10-29 13:15           ` Hans Verkuil
2020-10-30  2:47             ` Laurent Pinchart

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=gh5kef5bkeel3o6b2dkgc2dfagu9klj4c0@4ax.com \
    --to=jc@kynesim.co.uk \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).