[PATCH 1/2] drm/amdgpu: fix UBSAN warning in kv_dpm.c
Mario Limonciello
mario.limonciello at amd.com
Fri Jun 14 19:43:00 UTC 2024
On 6/14/2024 13:33, Alex Deucher wrote:
> Adds bounds check for sumo_vid_mapping_entry.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3392
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello at amd.com>
> ---
> drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> index 6bb42d04b247..e8b6989a40f3 100644
> --- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/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 =
More information about the amd-gfx
mailing list