summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorHelen Fornazier <helen.koike@collabora.co.uk>2016-05-10 00:06:14 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-28 08:05:09 -0300
commitd27d5f1a4d00808cb8751ddb972a40f952576fd8 (patch)
treea13b14bc0fe9ef0cf4c555aaf1103f3eae53534b /drivers/media/usb
parentf4bca74f3721b8726fe609c22534a3bad90d2790 (diff)
downloadlinux-d27d5f1a4d00808cb8751ddb972a40f952576fd8.tar.gz
linux-d27d5f1a4d00808cb8751ddb972a40f952576fd8.tar.bz2
linux-d27d5f1a4d00808cb8751ddb972a40f952576fd8.zip
[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 <helen.koike@collabora.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/stk1160/stk1160-v4l.c3
1 files changed, 3 insertions, 0 deletions
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;