From 6b1dce251fa21caea4e0021fd3fd0d8dcdece784 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 13 Apr 2013 07:39:19 -0300 Subject: [PATCH] [media] cx25821: s_input didn't check for invalid input The s_input implementation allowed input 1 even if that didn't exist. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821-video.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index a9aa09651cab..9ddc7ac03a73 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c @@ -1163,10 +1163,8 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) return err; } - if (i >= CX25821_NR_INPUT) { - dprintk(1, "%s(): -EINVAL\n", __func__); + if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0) return -EINVAL; - } mutex_lock(&dev->lock); cx25821_video_mux(dev, i);