From 961d3b27a2aff52dda0b97d35085a743a27c2f46 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Jun 2020 15:21:52 +0200 Subject: media: videobuf2: Fix length check for single plane dmabuf queueing 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/videobuf2/videobuf2-v4l2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media/common') diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 98477a82c810..57aa183bd198 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -117,7 +117,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) -- cgit v1.2.3