Commit 2a3cdc9f authored by Hersen Wu's avatar Hersen Wu Committed by Ze Zuo
Browse files

drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration

stable inclusion
from stable-v6.6.50
commit 8406158a546441b73f0b216aedacbf9a1e5748fb
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAU9OG
CVE: CVE-2024-46812

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8406158a546441b73f0b216aedacbf9a1e5748fb



--------------------------------

[ Upstream commit a54f7e866cc73a4cb71b8b24bb568ba35c8969df ]

[Why]
Coverity reports Memory - illegal accesses.

[How]
Skip inactive planes.

Reviewed-by: default avatarAlex Hung <alex.hung@amd.com>
Acked-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Signed-off-by: default avatarHersen Wu <hersenxs.wu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZe Zuo <zuoze1@huawei.com>
parent fb512ada
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1099,8 +1099,13 @@ void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib)

	// Total Available Pipes Support Check
	for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
		total_pipes += mode_lib->vba.DPPPerPlane[k];
		pipe_idx = get_pipe_idx(mode_lib, k);
		if (pipe_idx == -1) {
			ASSERT(0);
			continue; // skip inactive planes
		}
		total_pipes += mode_lib->vba.DPPPerPlane[k];

		if (mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz > 0.0)
			mode_lib->vba.DPPCLK[k] = mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz;
		else