Skip to content

Commit

Permalink
[media] gspca - stk014 / t613: Accept the index 0 in querymenu
Browse files Browse the repository at this point in the history
This patch fixes the kernel bug #15122.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jean-François Moine authored and Mauro Carvalho Chehab committed May 21, 2011
1 parent f7242d3 commit bff6069
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
15 changes: 6 additions & 9 deletions drivers/media/video/gspca/stk014.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu)
{
static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};

switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
break;
strcpy((char *) menu->name, freq_nm[menu->index]);
return 0;
}
return -EINVAL;
}
Expand Down
17 changes: 6 additions & 11 deletions drivers/media/video/gspca/t613.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_seteffect(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[] = {
{
Expand Down Expand Up @@ -1379,17 +1377,14 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val)
static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu)
{
static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};

switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
break;
strcpy((char *) menu->name, freq_nm[menu->index]);
return 0;
case V4L2_CID_EFFECTS:
if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
strncpy((char *) menu->name,
Expand Down

0 comments on commit bff6069

Please sign in to comment.