drm/amdgpu: fix UBSAN warning in kv_dpm.c
Subsystems (3)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu: fix UBSAN warning in kv_dpm.c
Adds bounds check for sumo_vid_mapping_entry.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +2 -0
@@ -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 =
Signature · 1 line
2.45.1
Alex Deucher
maintainerPATCH 2/2 drm/radeon: fix UBSAN warning in kv_dpm.c
Adds bounds check for sumo_vid_mapping_entry.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/radeon/sumo_dpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/sumo_dpm.c +2 -0
@@ -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 =
Signature · 1 line
2.45.1
Re: [PATCH 2/2] drm/radeon: fix UBSAN warning in kv_dpm.c
Quoted 3 lines · Alex Deucher
Adds bounds check for
sumo_vid_mapping_entry.Signed-off-by Alex Deucher <[email protected]>
Reviewed-by Mario Limonciello <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/radeon/sumo_dpm.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/radeon/sumo_dpm.c +2
-0@@ -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 =
Quoted 4 lines · Alex Deucher
Adds bounds check for
sumo_vid_mapping_entry.Signed-off-by Alex Deucher <[email protected]>
Reviewed-by Mario Limonciello <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +2
-0@@ -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 =