Skip to content

Commit

Permalink
[media] cx23885: fixes related to maximum number of inputs and range …
Browse files Browse the repository at this point in the history
…checking

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Oct 14, 2011
1 parent 2cb9ccd commit e92bcf8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/media/video/cx23885/cx23885-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e92bcf8

Please sign in to comment.