From 804e76f89d73d10b9fd7b25a48a6edc31faa40a9 Mon Sep 17 00:00:00 2001 From: Sudip Jain Date: Wed, 25 Feb 2015 12:24:53 +0530 Subject: [PATCH] media: vb2: Fill vb2_buffer with bytesused from user In vb2_qbuf for dmabuf memory type, userside bytesused is not copied in vb2 buffer. This leads to garbage value being copied from __qbuf_dmabuf() back to user in __fill_v4l2_buffer(). As a default case, the vb2 framework must return the default value to the user, if the driver's buffer prepare function prefers not to modify/update. Change-Id: Ieda389403898935f59c2e2994106f3e5238cfefd Signed-off-by: Sudip Jain --- drivers/media/v4l2-core/videobuf2-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 5e47ba4..54fe9c9 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -919,6 +919,8 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b b->m.planes[plane].m.fd; v4l2_planes[plane].length = b->m.planes[plane].length; + v4l2_planes[plane].bytesused = + b->m.planes[plane].bytesused; v4l2_planes[plane].data_offset = b->m.planes[plane].data_offset; } @@ -943,6 +945,7 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b if (b->memory == V4L2_MEMORY_DMABUF) { v4l2_planes[0].m.fd = b->m.fd; v4l2_planes[0].length = b->length; + v4l2_planes[0].bytesused = b->bytesused; v4l2_planes[0].data_offset = 0; } -- 1.7.9.5