From e614675865b639a9ff782a550d25aaf2952e6240 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 28 Jun 2024 03:37:58 +0000 Subject: [PATCH] drm/amdgpu: fix UBSAN warning in kv_dpm.c From Alex Deucher b065d79ed06a0bb4377bc6dcc2ff0cb1f55a798f in linux-6.6.y/6.6.36 f0d576f840153392d04b2d52cf3adab8f62e8cb6 in mainline linux --- sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c b/sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c index 5cb4725c773..c8586cb7d0f 100644 --- a/sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c +++ b/sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c @@ -164,6 +164,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.20.1