aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2011-05-17 02:58:57 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-21 08:33:31 -0400
commitbff6069dc16c84862a915d1d5564789928c173bf (patch)
tree8718f6b0f084093c68ddeb92522cce5ebb89a51d /drivers/media
parentf7242d30034da3f2937fbe9eb3d17355bbff58d1 (diff)
[media] gspca - stk014 / t613: Accept the index 0 in querymenu
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/stk014.c15
-rw-r--r--drivers/media/video/gspca/t613.c17
2 files changed, 12 insertions, 20 deletions
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 87be52b5e1e3..763747700f10 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -436,17 +436,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
436static int sd_querymenu(struct gspca_dev *gspca_dev, 436static int sd_querymenu(struct gspca_dev *gspca_dev,
437 struct v4l2_querymenu *menu) 437 struct v4l2_querymenu *menu)
438{ 438{
439 static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};
440
439 switch (menu->id) { 441 switch (menu->id) {
440 case V4L2_CID_POWER_LINE_FREQUENCY: 442 case V4L2_CID_POWER_LINE_FREQUENCY:
441 switch (menu->index) { 443 if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
442 case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ 444 break;
443 strcpy((char *) menu->name, "50 Hz"); 445 strcpy((char *) menu->name, freq_nm[menu->index]);
444 return 0; 446 return 0;
445 case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
446 strcpy((char *) menu->name, "60 Hz");
447 return 0;
448 }
449 break;
450 } 447 }
451 return -EINVAL; 448 return -EINVAL;
452} 449}
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index a3eccd815766..7e762d551099 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -92,8 +92,6 @@ static int sd_setmirror(struct gspca_dev *gspca_dev, __s32 val);
92static int sd_getmirror(struct gspca_dev *gspca_dev, __s32 *val); 92static int sd_getmirror(struct gspca_dev *gspca_dev, __s32 *val);
93static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val); 93static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val);
94static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val); 94static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val);
95static int sd_querymenu(struct gspca_dev *gspca_dev,
96 struct v4l2_querymenu *menu);
97 95
98static const struct ctrl sd_ctrls[] = { 96static const struct ctrl sd_ctrls[] = {
99 { 97 {
@@ -1379,17 +1377,14 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val)
1379static int sd_querymenu(struct gspca_dev *gspca_dev, 1377static int sd_querymenu(struct gspca_dev *gspca_dev,
1380 struct v4l2_querymenu *menu) 1378 struct v4l2_querymenu *menu)
1381{ 1379{
1380 static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};
1381
1382 switch (menu->id) { 1382 switch (menu->id) {
1383 case V4L2_CID_POWER_LINE_FREQUENCY: 1383 case V4L2_CID_POWER_LINE_FREQUENCY:
1384 switch (menu->index) { 1384 if ((unsigned) menu->index >= ARRAY_SIZE(freq_nm))
1385 case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ 1385 break;
1386 strcpy((char *) menu->name, "50 Hz"); 1386 strcpy((char *) menu->name, freq_nm[menu->index]);
1387 return 0; 1387 return 0;
1388 case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
1389 strcpy((char *) menu->name, "60 Hz");
1390 return 0;
1391 }
1392 break;
1393 case V4L2_CID_EFFECTS: 1388 case V4L2_CID_EFFECTS:
1394 if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) { 1389 if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
1395 strncpy((char *) menu->name, 1390 strncpy((char *) menu->name,