media: uvcvideo: Fix dereference of out-of-bound list iterator
authorDaniel W. S. Almeida <dwlsalmeida@gmail.com>
Fri, 7 Aug 2020 08:35:30 +0000 (10:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:41 +0000 (11:08 +0100)
commit3aff03d9b92c0553f491e36807cda5826c3dc95d
treede59de093a83625dbdd8cb6f324e4295543e8224
parentcbc03dedecb6e5366f2d3f0a328cfc3ef4762a25
media: uvcvideo: Fix dereference of out-of-bound list iterator

[ Upstream commit f875bcc375c738bf2f599ff2e1c5b918dbd07c45 ]

Fixes the following coccinelle report:

drivers/media/usb/uvc/uvc_ctrl.c:1860:5-11:
ERROR: invalid reference to the index variable of the iterator on line 1854

by adding a boolean variable to check if the loop has found the

Found using - Coccinelle (http://coccinelle.lip6.fr)

[Replace cursor variable with bool found]

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/uvc/uvc_ctrl.c