From: jsg Date: Fri, 28 Jun 2024 03:35:06 +0000 (+0000) Subject: drm/radeon: fix UBSAN warning in kv_dpm.c X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=93f8bf6e41b6cd6704a54c2d90c2a7655c097bbf;p=openbsd 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 --- 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 =