From: Helen Fornazier Date: Tue, 10 May 2016 03:06:14 +0000 (-0300) Subject: [media] stk1160: Check *nplanes in queue_setup X-Git-Tag: v4.8-rc1~152^2~223 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d27d5f1a4d00808cb8751ddb972a40f952576fd8;p=karo-tx-linux.git [media] stk1160: Check *nplanes in queue_setup If *nplanes is not zero, it should use the requested size if valid Signed-off-by: Helen Koike Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index 77131fd614a5..7ddbc0274f12 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -680,6 +680,9 @@ static int queue_setup(struct vb2_queue *vq, *nbuffers = clamp_t(unsigned int, *nbuffers, STK1160_MIN_VIDEO_BUFFERS, STK1160_MAX_VIDEO_BUFFERS); + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; + /* This means a packed colorformat */ *nplanes = 1;