Skip to content

Commit e5fe36e

Browse files
Jinjie RuanSasha Levin
authored andcommitted
media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate()
commit d2842de upstream. In set_frame_rate(), select a rate in rate_0 or rate_1 by checking sd->frame_rate >= r->fps in a loop, but the loop condition terminates when the index reaches zero, which fails to check the last elememt in rate_0 or rate_1. Check for >= 0 so that the last one in rate_0 or rate_1 is also checked. Fixes: 189d92a ("V4L/DVB (13422): gspca - ov534: ov772x changes from Richard Kaswy.") Cc: [email protected] Signed-off-by: Jinjie Ruan <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7673b85 commit e5fe36e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/media/usb/gspca/ov534.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ static void set_frame_rate(struct gspca_dev *gspca_dev)
847847
r = rate_1;
848848
i = ARRAY_SIZE(rate_1);
849849
}
850-
while (--i > 0) {
850+
while (--i >= 0) {
851851
if (sd->frame_rate >= r->fps)
852852
break;
853853
r++;

0 commit comments

Comments
 (0)