V4L/DVB (12071): gspca: fix NULL pointer deref in query_ctrl
authorHans de Goede <hdegoede@redhat.com>
Sat, 13 Jun 2009 21:56:22 +0000 (18:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 23 Jun 2009 06:11:07 +0000 (03:11 -0300)
gspca: fix NULL pointer deref in query_ctrl

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index f7e0355..1e89600 100644 (file)
@@ -1042,13 +1042,11 @@ static int vidioc_queryctrl(struct file *file, void *priv,
                for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) {
                        if (gspca_dev->ctrl_dis & (1 << i))
                                continue;
-                       if (ctrls->qctrl.id < id)
+                       if (gspca_dev->sd_desc->ctrls[i].qctrl.id < id)
                                continue;
-                       if (ctrls != NULL) {
-                               if (gspca_dev->sd_desc->ctrls[i].qctrl.id
+                       if (ctrls && gspca_dev->sd_desc->ctrls[i].qctrl.id
                                            > ctrls->qctrl.id)
-                                       continue;
-                       }
+                               continue;
                        ctrls = &gspca_dev->sd_desc->ctrls[i];
                }
        } else {