drm/amd: check num of link levels when update pcie param
authorLin.Cao <lincao12@amd.com>
Wed, 25 Oct 2023 03:32:41 +0000 (11:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:19:41 +0000 (17:19 +0000)
commit09f617219fe9ccd8d7b65dc3e879b5889f663b5a
treea5b2f603f5bb485ef5d023e4d7005b3585654f5a
parentb58ace0e8c981ab884d5014369aea9f3d611d5e4
drm/amd: check num of link levels when update pcie param

[ Upstream commit 406e8845356d18bdf3d3a23b347faf67706472ec ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c