mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
UPSTREAM: usb: gadget: uvc: prevent index variables to start from 0
Some configfs variables like bDefaultFrameIndex are always starting by
1. This patch adds a check to prevent setting those variables to 0.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220421211427.3400834-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a350cfb653)
Bug: 242344221
Change-Id: Ieb800223fe0071c7a3650b146a1d0c6f5f7ad8a2
Signed-off-by: Avichal Rakesh <arakesh@google.com>
This commit is contained in:
committed by
Todd Kjos
parent
da9de7cbf5
commit
fc33d1de5c
@@ -1570,6 +1570,12 @@ uvcg_uncompressed_##cname##_store(struct config_item *item, \
|
||||
if (ret) \
|
||||
goto end; \
|
||||
\
|
||||
/* index values in uvc are never 0 */ \
|
||||
if (!num) { \
|
||||
ret = -EINVAL; \
|
||||
goto end; \
|
||||
} \
|
||||
\
|
||||
u->desc.aname = num; \
|
||||
ret = len; \
|
||||
end: \
|
||||
@@ -1763,6 +1769,12 @@ uvcg_mjpeg_##cname##_store(struct config_item *item, \
|
||||
if (ret) \
|
||||
goto end; \
|
||||
\
|
||||
/* index values in uvc are never 0 */ \
|
||||
if (!num) { \
|
||||
ret = -EINVAL; \
|
||||
goto end; \
|
||||
} \
|
||||
\
|
||||
u->desc.aname = num; \
|
||||
ret = len; \
|
||||
end: \
|
||||
|
||||
Reference in New Issue
Block a user