summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2011-10-10 18:09:55 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-10-15 00:19:46 +0400
commite92bcf8d8abb654cb916f3e615697320bc6bf1e1 (patch)
tree63cbe676f45fa266b42c124ced144954cefded45 /drivers/media
parent2cb9ccd4612907c0a30de9be1c694672e0cd8933 (diff)
downloadlinux-e92bcf8d8abb654cb916f3e615697320bc6bf1e1.tar.xz
[media] cx23885: fixes related to maximum number of inputs and range checking
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index f13c40e653c1..596b46e7bc51 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1239,7 +1239,7 @@ static int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
dprintk(1, "%s()\n", __func__);
n = i->index;
- if (n >= 4)
+ if (n >= MAX_CX23885_INPUT)
return -EINVAL;
if (0 == INPUT(n)->type)
@@ -1279,11 +1279,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
dprintk(1, "%s(%d)\n", __func__, i);
- if (i >= 4) {
+ if (i >= MAX_CX23885_INPUT) {
dprintk(1, "%s() -EINVAL\n", __func__);
return -EINVAL;
}
+ if (INPUT(i)->type == 0)
+ return -EINVAL;
+
mutex_lock(&dev->lock);
cx23885_video_mux(dev, i);
mutex_unlock(&dev->lock);