mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-21 05:14:52 +08:00
media: uvcvideo: Fix invalid pointer in uvc_ctrl_init_ctrl()
The handling of per-device mappings introduced in commit86f7ef7731
("media: uvcvideo: Add support for per-device control mapping overrides") overwrote the mapping variable after it was initialized and before it was used, leading to usage of an invalid pointer for devices with per-device mappings. Fix it. Fixes:86f7ef7731
("media: uvcvideo: Add support for per-device control mapping overrides") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
bb85604b9a
commit
21b1b6797f
@ -2413,9 +2413,8 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
|
||||
{
|
||||
const struct uvc_control_info *info = uvc_ctrls;
|
||||
const struct uvc_control_info *iend = info + ARRAY_SIZE(uvc_ctrls);
|
||||
const struct uvc_control_mapping *mapping = uvc_ctrl_mappings;
|
||||
const struct uvc_control_mapping *mend =
|
||||
mapping + ARRAY_SIZE(uvc_ctrl_mappings);
|
||||
const struct uvc_control_mapping *mapping;
|
||||
const struct uvc_control_mapping *mend;
|
||||
|
||||
/*
|
||||
* XU controls initialization requires querying the device for control
|
||||
@ -2468,6 +2467,9 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
|
||||
}
|
||||
|
||||
/* Process common mappings next. */
|
||||
mapping = uvc_ctrl_mappings;
|
||||
mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings);
|
||||
|
||||
for (; mapping < mend; ++mapping) {
|
||||
if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
|
||||
ctrl->info.selector == mapping->selector)
|
||||
|
Loading…
Reference in New Issue
Block a user