mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 22:42:04 +00:00
media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate()
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: 189d92af70
("V4L/DVB (13422): gspca - ov534: ov772x changes from Richard Kaswy.")
Cc: stable@vger.kernel.org
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
2a20869f7d
commit
d2842dec57
@ -847,7 +847,7 @@ static void set_frame_rate(struct gspca_dev *gspca_dev)
|
||||
r = rate_1;
|
||||
i = ARRAY_SIZE(rate_1);
|
||||
}
|
||||
while (--i > 0) {
|
||||
while (--i >= 0) {
|
||||
if (sd->frame_rate >= r->fps)
|
||||
break;
|
||||
r++;
|
||||
|
Loading…
Reference in New Issue
Block a user