Commit bff6069d authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

[media] gspca - stk014 / t613: Accept the index 0 in querymenu

This patch fixes the kernel bug #15122.
Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f7242d30
...@@ -436,17 +436,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -436,17 +436,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static int sd_querymenu(struct gspca_dev *gspca_dev, static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu) struct v4l2_querymenu *menu)
{ {
static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};
switch (menu->id) { switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY: case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) { if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ break;
strcpy((char *) menu->name, "50 Hz"); strcpy((char *) menu->name, freq_nm[menu->index]);
return 0; return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
} }
return -EINVAL; return -EINVAL;
} }
......
...@@ -92,8 +92,6 @@ static int sd_setmirror(struct gspca_dev *gspca_dev, __s32 val); ...@@ -92,8 +92,6 @@ static int sd_setmirror(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getmirror(struct gspca_dev *gspca_dev, __s32 *val); static int sd_getmirror(struct gspca_dev *gspca_dev, __s32 *val);
static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val); static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val);
static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val); static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val);
static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu);
static const struct ctrl sd_ctrls[] = { static const struct ctrl sd_ctrls[] = {
{ {
...@@ -1379,17 +1377,14 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -1379,17 +1377,14 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val)
static int sd_querymenu(struct gspca_dev *gspca_dev, static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu) struct v4l2_querymenu *menu)
{ {
static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};
switch (menu->id) { switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY: case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) { if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ break;
strcpy((char *) menu->name, "50 Hz"); strcpy((char *) menu->name, freq_nm[menu->index]);
return 0; return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
case V4L2_CID_EFFECTS: case V4L2_CID_EFFECTS:
if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) { if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
strncpy((char *) menu->name, strncpy((char *) menu->name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment