diff options
author | Steven Toth <stoth@kernellabs.com> | 2011-10-10 10:09:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-10-14 16:19:46 -0400 |
commit | e92bcf8d8abb654cb916f3e615697320bc6bf1e1 (patch) | |
tree | 63cbe676f45fa266b42c124ced144954cefded45 /drivers/media/video/cx23885 | |
parent | 2cb9ccd4612907c0a30de9be1c694672e0cd8933 (diff) |
[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/video/cx23885')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 7 |
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) | |||
1239 | dprintk(1, "%s()\n", __func__); | 1239 | dprintk(1, "%s()\n", __func__); |
1240 | 1240 | ||
1241 | n = i->index; | 1241 | n = i->index; |
1242 | if (n >= 4) | 1242 | if (n >= MAX_CX23885_INPUT) |
1243 | return -EINVAL; | 1243 | return -EINVAL; |
1244 | 1244 | ||
1245 | if (0 == INPUT(n)->type) | 1245 | if (0 == INPUT(n)->type) |
@@ -1279,11 +1279,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1279 | 1279 | ||
1280 | dprintk(1, "%s(%d)\n", __func__, i); | 1280 | dprintk(1, "%s(%d)\n", __func__, i); |
1281 | 1281 | ||
1282 | if (i >= 4) { | 1282 | if (i >= MAX_CX23885_INPUT) { |
1283 | dprintk(1, "%s() -EINVAL\n", __func__); | 1283 | dprintk(1, "%s() -EINVAL\n", __func__); |
1284 | return -EINVAL; | 1284 | return -EINVAL; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | if (INPUT(i)->type == 0) | ||
1288 | return -EINVAL; | ||
1289 | |||
1287 | mutex_lock(&dev->lock); | 1290 | mutex_lock(&dev->lock); |
1288 | cx23885_video_mux(dev, i); | 1291 | cx23885_video_mux(dev, i); |
1289 | mutex_unlock(&dev->lock); | 1292 | mutex_unlock(&dev->lock); |