Re: [PATCH 2/2] drm/radeon: fix UBSAN warning in kv_dpm.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/14/2024 13:33, Alex Deucher wrote:
Adds bounds check for sumo_vid_mapping_entry.

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
  drivers/gpu/drm/radeon/sumo_dpm.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c
index 21d27e6235f3..b11f7c5bbcbe 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -1619,6 +1619,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 =




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux