mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
drm/amdgpu: fix UBSAN warning in kv_dpm.c
commit f0d576f840
upstream.
Adds bounds check for sumo_vid_mapping_entry.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3392
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
468a50fd46
commit
b0d612619e
1 changed files with 2 additions and 0 deletions
|
@ -164,6 +164,8 @@ static void sumo_construct_vid_mapping_table(struct amdgpu_device *adev,
|
||||||
|
|
||||||
for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) {
|
for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) {
|
||||||
if (table[i].ulSupportedSCLK != 0) {
|
if (table[i].ulSupportedSCLK != 0) {
|
||||||
|
if (table[i].usVoltageIndex >= SUMO_MAX_NUMBER_VOLTAGES)
|
||||||
|
continue;
|
||||||
vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit =
|
vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit =
|
||||||
table[i].usVoltageID;
|
table[i].usVoltageID;
|
||||||
vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit =
|
vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit =
|
||||||
|
|
Loading…
Reference in a new issue