Skip to content

Commit 406e884

Browse files
Lin.Caoalexdeucher
authored andcommitted
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: Lin.Cao <lincao12@amd.com> Acked-by: Jingwen Chen <Jingwen.Chen2@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 3f69d58 commit 406e884

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,9 @@ int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
24382438
uint32_t smu_pcie_arg;
24392439
int ret, i;
24402440

2441+
if (!num_of_levels)
2442+
return 0;
2443+
24412444
if (!(smu->adev->pm.pp_feature & PP_PCIE_DPM_MASK)) {
24422445
if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap)
24432446
pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1];

0 commit comments

Comments
 (0)