Commit 760efbca authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher

drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7

For pptable structs that use flexible array sizes, use flexible arrays.
Suggested-by: default avatarFelix Held <felix.held@amd.com>
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2874Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c8e7df37
...@@ -78,7 +78,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLER ...@@ -78,7 +78,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLER
typedef struct _ATOM_PPLIB_STATE typedef struct _ATOM_PPLIB_STATE
{ {
UCHAR ucNonClockStateIndex; UCHAR ucNonClockStateIndex;
UCHAR ucClockStateIndices[1]; // variable-sized UCHAR ucClockStateIndices[]; // variable-sized
} ATOM_PPLIB_STATE; } ATOM_PPLIB_STATE;
...@@ -473,7 +473,7 @@ typedef struct _ATOM_PPLIB_STATE_V2 ...@@ -473,7 +473,7 @@ typedef struct _ATOM_PPLIB_STATE_V2
/** /**
* Driver will read the first ucNumDPMLevels in this array * Driver will read the first ucNumDPMLevels in this array
*/ */
UCHAR clockInfoIndex[1]; UCHAR clockInfoIndex[];
} ATOM_PPLIB_STATE_V2; } ATOM_PPLIB_STATE_V2;
typedef struct _StateArray{ typedef struct _StateArray{
......
...@@ -179,7 +179,7 @@ typedef struct _ATOM_Tonga_MCLK_Dependency_Record { ...@@ -179,7 +179,7 @@ typedef struct _ATOM_Tonga_MCLK_Dependency_Record {
typedef struct _ATOM_Tonga_MCLK_Dependency_Table { typedef struct _ATOM_Tonga_MCLK_Dependency_Table {
UCHAR ucRevId; UCHAR ucRevId;
UCHAR ucNumEntries; /* Number of entries. */ 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; } ATOM_Tonga_MCLK_Dependency_Table;
typedef struct _ATOM_Tonga_SCLK_Dependency_Record { typedef struct _ATOM_Tonga_SCLK_Dependency_Record {
...@@ -194,7 +194,7 @@ 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 { typedef struct _ATOM_Tonga_SCLK_Dependency_Table {
UCHAR ucRevId; UCHAR ucRevId;
UCHAR ucNumEntries; /* Number of entries. */ 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; } ATOM_Tonga_SCLK_Dependency_Table;
typedef struct _ATOM_Polaris_SCLK_Dependency_Record { typedef struct _ATOM_Polaris_SCLK_Dependency_Record {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment