]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate()
authorJinjie Ruan <ruanjinjie@huawei.com>
Mon, 28 Oct 2024 08:02:56 +0000 (16:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:47:36 +0000 (19:47 +0100)
commitda56bb85895470af27509fca54dc67317fa17a55
tree4d3ac568a5cdd71bf94976eba17487954e7ce5b0
parent580d1e5cf2cd4d1401aeb74d24023b4499adc0b3
media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate()

commit d2842dec577900031826dc44e9bf0c66416d7173 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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/usb/gspca/ov534.c