]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amd/display: Fix out-of-bound accesses
authorAlex Hung <alex.hung@amd.com>
Fri, 17 Jan 2025 19:37:11 +0000 (12:37 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 3 Feb 2025 17:12:04 +0000 (12:12 -0500)
commit8adbb2a98b00926315fd513b5fe2596b5716b82d
tree45a74992991b0f3ddeed91ec13f8cb1a5654e2cc
parent2255b40cacc2e5ef1b127770fc1808c60de4a2fc
drm/amd/display: Fix out-of-bound accesses

[WHAT & HOW]
hpo_stream_to_link_encoder_mapping has size MAX_HPO_DP2_ENCODERS(=4),
but location can have size up to 6. As a result, it is necessary to
check location against MAX_HPO_DP2_ENCODERS.

Similiarly, disp_cfg_stream_location can be used as an array index which
should be 0..5, so the ASSERT's conditions should be less without equal.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3904
Reviewed-by: Austin Zheng <Austin.Zheng@amd.com>
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c