Commit 0b153314 authored by Jesse Zhang's avatar Jesse Zhang Committed by Huang Xiaojia
Browse files

drm/amd/pm: fix the Out-of-bounds read warning

stable inclusion
from stable-v6.6.50
commit f1e261ced9bcad772a45a2fcdf413c3490e87299
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IARV5V
CVE: CVE-2024-46731

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



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

[ Upstream commit 12c6967428a099bbba9dfd247bb4322a984fcc0b ]

using index i - 1U may beyond element index
for mc_data[] when i = 0.

Signed-off-by: default avatarJesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: default avatarTim Huang <Tim.Huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 70522ace
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ static int atomctrl_retrieve_ac_timing(
					j++;
				} else if ((table->mc_reg_address[i].uc_pre_reg_data &
							LOW_NIBBLE_MASK) == DATA_EQU_PREV) {
					if (i)
						table->mc_reg_table_entry[num_ranges].mc_data[i] =
							table->mc_reg_table_entry[num_ranges].mc_data[i-1];
				}