]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: Stop amdgpu_dm initialize when link nums greater than max_links
authorHersen Wu <hersenxs.wu@amd.com>
Wed, 24 Apr 2024 20:15:15 +0000 (16:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:44:19 +0000 (07:44 +0200)
commite3cd0d8362de47f613bfdf315b3f3a9ab71e66bf
tree9647221779b7f999387e999de3fff76a0bc832b2
parent27fda36eedad9e4ec795dc481f307901d1885112
drm/amd/display: Stop amdgpu_dm initialize when link nums greater than max_links

commit cf8b16857db702ceb8d52f9219a4613363e2b1cf upstream.

[Why]
Coverity report OVERRUN warning. There are
only max_links elements within dc->links. link
count could up to AMDGPU_DM_MAX_DISPLAY_INDEX 31.

[How]
Make sure link count less than max_links.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[Minor conflict resolved due to code context change. And the macro MAX_LINKS
 is introduced by Commit 60df5628144b ("drm/amd/display: handle invalid
 connector indices") after 6.10. So here we still use the original array
 length MAX_PIPES * 2]
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c