[media] cx25821: s_input didn't check for invalid input
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 13 Apr 2013 10:39:19 +0000 (07:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Apr 2013 21:02:23 +0000 (18:02 -0300)
The s_input implementation allowed input 1 even if that didn't exist.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/cx25821/cx25821-video.c

index a9aa09651cab8dcbeaa991d903dce3e3498b984d..9ddc7ac03a7377bd49de4e08580ac08f08f7b99d 100644 (file)
@@ -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);