LinuxTV Patchwork [09/10] media: coda: throw error on create_bufs with too small size

login
register
mail settings
Submitter Philipp Zabel
Date April 8, 2019, 12:32 p.m.
Message ID <20190408123256.22868-9-p.zabel@pengutronix.de>
Download mbox | patch
Permalink /patch/55534/
State Under Review
Delegated to: Hans Verkuil
Headers show

Comments

Philipp Zabel - April 8, 2019, 12:32 p.m.
If VIDIOC_CREATE_BUFS is called with a sizeimage smaller than the
queue sizeimage, fail with -EINVAL instead of correcting the size
and continuing without error. This is required by v4l2-compliance.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/coda/coda-common.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 7b89dbae938d..318f0be103bb 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1522,6 +1522,9 @@  static int coda_queue_setup(struct vb2_queue *vq,
 	q_data = get_q_data(ctx, vq->type);
 	size = q_data->sizeimage;
 
+	if (*nplanes)
+		return sizes[0] < size ? -EINVAL : 0;
+
 	*nplanes = 1;
 	sizes[0] = size;
 

Privacy Policy