summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-10-28 09:02:56 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2024-11-07 09:05:57 +0100
commitd2842dec577900031826dc44e9bf0c66416d7173 (patch)
tree801a84d353f8e286131b18d361374104a86c662e
parentmedia: venus: Fix pm_runtime_set_suspended() with runtime pm enabled (diff)
downloadlinux-d2842dec577900031826dc44e9bf0c66416d7173.tar.xz
linux-d2842dec577900031826dc44e9bf0c66416d7173.zip
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: 189d92af707e ("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>
-rw-r--r--drivers/media/usb/gspca/ov534.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c
index 8b6a57f170d0..bdff64a29a33 100644
--- a/drivers/media/usb/gspca/ov534.c
+++ b/drivers/media/usb/gspca/ov534.c
@@ -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++;