mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
media: amphion: ensure the bitops don't cross boundaries
the supported_instance_count determine the instance index range,
it shouldn't exceed the bits number of instance_mask,
otherwise the bitops of instance_mask may cross boundaries
Fixes: 9f599f351e
("media: amphion: add vpu core driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
cf6a063549
commit
5bd28eae48
1 changed files with 2 additions and 0 deletions
|
@ -88,6 +88,8 @@ static int vpu_core_boot_done(struct vpu_core *core)
|
|||
|
||||
core->supported_instance_count = min(core->supported_instance_count, count);
|
||||
}
|
||||
if (core->supported_instance_count >= BITS_PER_TYPE(core->instance_mask))
|
||||
core->supported_instance_count = BITS_PER_TYPE(core->instance_mask);
|
||||
core->fw_version = fw_version;
|
||||
vpu_core_set_state(core, VPU_CORE_ACTIVE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue