From 93f8bf6e41b6cd6704a54c2d90c2a7655c097bbf Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 28 Jun 2024 03:35:06 +0000 Subject: [PATCH] drm/radeon: fix UBSAN warning in kv_dpm.c From Alex Deucher 9e57611182a817824a17b1c3dd300ee74a174b42 in linux-6.6.y/6.6.36 a498df5421fd737d11bfd152428ba6b1c8538321 in mainline linux --- sys/dev/pci/drm/radeon/sumo_dpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/pci/drm/radeon/sumo_dpm.c b/sys/dev/pci/drm/radeon/sumo_dpm.c index d49c145db43..f7f1ddc6cdd 100644 --- a/sys/dev/pci/drm/radeon/sumo_dpm.c +++ b/sys/dev/pci/drm/radeon/sumo_dpm.c @@ -1621,6 +1621,8 @@ void sumo_construct_vid_mapping_table(struct radeon_device *rdev, 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