Hi John, Thank you for the patch. On Wed, Jun 17, 2020 at 02:21:52PM +0100, John Cox wrote: > 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@xxxxxxxxxxxxx> > --- > 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; I don't think this is correct, as it breaks DMABUF import. For USERPTR the length needs to be passed by userspace, but for DMABUF, we allow userspace to set length to 0, and use the length retrieved from the dma_buf. With this change, b->length is 0, and the check fails. > > if (b->bytesused > length) -- Regards, Laurent Pinchart