media: coda: throw error on create_bufs with too small size
authorPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 8 Apr 2019 12:32:55 +0000 (08:32 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 22 Apr 2019 16:11:13 +0000 (12:11 -0400)
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>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-common.c

index a89d92f5539f2fffa454eadf26b1d1f37b8a9bf7..3ce58dee4422bd16d61802c641e16e392a9597a3 100644 (file)
@@ -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;