From 7095acedb239a3cd523d421b3bd960eb776c15e0 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 30 Nov 2023 02:28:39 +0000 Subject: [PATCH] drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 From Mario Limonciello fc9ac0e8e0bcb3740c6eaad3a1a50c20016d422b in linux-6.1.y/6.1.64 760efbca74a405dc439a013a5efaa9fadc95a8c3 in mainline linux --- sys/dev/pci/drm/amd/include/pptable.h | 4 ++-- sys/dev/pci/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/drm/amd/include/pptable.h b/sys/dev/pci/drm/amd/include/pptable.h index 0b6a057e0a4..5aac8d545bd 100644 --- a/sys/dev/pci/drm/amd/include/pptable.h +++ b/sys/dev/pci/drm/amd/include/pptable.h @@ -78,7 +78,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLER typedef struct _ATOM_PPLIB_STATE { UCHAR ucNonClockStateIndex; - UCHAR ucClockStateIndices[1]; // variable-sized + UCHAR ucClockStateIndices[]; // variable-sized } ATOM_PPLIB_STATE; @@ -473,7 +473,7 @@ typedef struct _ATOM_PPLIB_STATE_V2 /** * Driver will read the first ucNumDPMLevels in this array */ - UCHAR clockInfoIndex[1]; + UCHAR clockInfoIndex[]; } ATOM_PPLIB_STATE_V2; typedef struct _StateArray{ diff --git a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h index b0ac4d121ad..41444e27bfc 100644 --- a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +++ b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h @@ -179,7 +179,7 @@ typedef struct _ATOM_Tonga_MCLK_Dependency_Record { typedef struct _ATOM_Tonga_MCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_MCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_MCLK_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_MCLK_Dependency_Table; typedef struct _ATOM_Tonga_SCLK_Dependency_Record { @@ -194,7 +194,7 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Record { typedef struct _ATOM_Tonga_SCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_SCLK_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_SCLK_Dependency_Table; typedef struct _ATOM_Polaris_SCLK_Dependency_Record { -- 2.20.1