From d24b19b76506d055d0a50337127559dcea967aa1 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 27 Jun 2024 14:51:42 -0400 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch | 36 +++++++++++++++++++ queue-5.10/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 queue-5.10/drm-amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch diff --git a/queue-5.10/drm-amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch b/queue-5.10/drm-amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch new file mode 100644 index 00000000000..ddbf6703e1b --- /dev/null +++ b/queue-5.10/drm-amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch @@ -0,0 +1,36 @@ +From 264d427a1f7e06cb6b54da4f7ba25871d1e4f1fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 May 2024 09:05:21 -0400 +Subject: drm/amdgpu: fix UBSAN warning in kv_dpm.c + +From: Alex Deucher + +[ Upstream commit f0d576f840153392d04b2d52cf3adab8f62e8cb6 ] + +Adds bounds check for sumo_vid_mapping_entry. + +Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3392 +Reviewed-by: Mario Limonciello +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c b/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c +index 6eb6f05c11367..56e15f5bc8225 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c +@@ -163,6 +163,8 @@ static void sumo_construct_vid_mapping_table(struct amdgpu_device *adev, + + for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) { + if (table[i].ulSupportedSCLK != 0) { ++ if (table[i].usVoltageIndex >= SUMO_MAX_NUMBER_VOLTAGES) ++ continue; + vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit = + table[i].usVoltageID; + vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit = +-- +2.43.0 + diff --git a/queue-5.10/series b/queue-5.10/series index d6d738b9d44..727cc43f603 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -261,3 +261,4 @@ pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch pinctrl-rockchip-separate-struct-rockchip_pin_bank-t.patch pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch +drm-amdgpu-fix-ubsan-warning-in-kv_dpm.c.patch -- 2.47.3