From 0eecc61947ed329659a9fa9ef7d0959b1c84259d Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Mon, 8 Apr 2019 08:32:55 -0400 Subject: media: coda: throw error on create_bufs with too small size 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/coda/coda-common.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/media/platform/coda') diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index a89d92f5539f..3ce58dee4422 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -1501,6 +1501,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; -- cgit v1.2.3