Commit 406e8845 authored by Lin.Cao's avatar Lin.Cao Committed by Alex Deucher
Browse files

drm/amd: check num of link levels when update pcie param



In SR-IOV environment, the value of pcie_table->num_of_link_levels will
be 0, and num_of_levels - 1 will cause array index out of bounds

Signed-off-by: default avatarLin.Cao <lincao12@amd.com>
Acked-by: default avatarJingwen Chen <Jingwen.Chen2@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3f69d586
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2438,6 +2438,9 @@ int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
	uint32_t smu_pcie_arg;
	int ret, i;

	if (!num_of_levels)
		return 0;

	if (!(smu->adev->pm.pp_feature & PP_PCIE_DPM_MASK)) {
		if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap)
			pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1];