drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
Subsystems (3)
PATCH 1/2 drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
For pptable structs that use flexible array sizes, use flexible arrays.
Suggested-by Felix Held <[email protected]>
Signed-off-by Mario Limonciello <[email protected]>
--- drivers/gpu/drm/amd/include/pptable.h | 4 ++-- drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/include/pptable.h +2 -2
@@ -78,7 +78,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLERtypedef 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{
drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +2 -2
@@ -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 {
Signature · 1 line
2.34.1
PATCH 2/2 drm/radeon: Fix UBSAN array-index-out-of-bounds for Radeon HD 5430
For pptable structs that use flexible array sizes, use flexible arrays.
Suggested-by Felix Held <[email protected]>
Signed-off-by Mario Limonciello <[email protected]>
--- drivers/gpu/drm/radeon/pptable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/pptable.h +1 -1
@@ -74,7 +74,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLERtypedef struct _ATOM_PPLIB_STATE {UCHAR ucNonClockStateIndex; -UCHAR ucClockStateIndices[1 ];// variable-sized +UCHAR ucClockStateIndices[];// variable-sized }ATOM_PPLIB_STATE ;
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm/radeon: Fix UBSAN array-index-out-of-bounds for Radeon HD 5430
Quoted 6 lines · Mario Limonciello
For pptable structs that use flexible array sizes, use flexible arrays.
Suggested-by Felix Held <[email protected]>Signed-off-by Mario Limonciello <[email protected]>
Series is:
Acked-by Alex Deucher <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/radeon/pptable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/pptable.h +1
-2@@ -74,7 +74,7 @@ typedef struct _ATOM_PPLIB_THERMALCONTROLLERtypedef struct _ATOM_PPLIB_STATE {UCHAR ucNonClockStateIndex; -UCHAR ucClockStateIndices[1 ];// variable-sized +UCHAR ucClockStateIndices[];// variable-sized }ATOM_PPLIB_STATE ; --2.34.1