[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BL1PR12MB5144AB90E81B7AF182B77464F7E6A@BL1PR12MB5144.namprd12.prod.outlook.com>
Date: Wed, 30 Aug 2023 19:11:42 +0000
From: "Deucher, Alexander" <Alexander.Deucher@....com>
To: Samuel Holland <samuel.holland@...ive.com>,
"Quan, Evan" <Evan.Quan@....com>,
"Koenig, Christian" <Christian.Koenig@....com>,
"gustavo@...eddedor.com" <gustavo@...eddedor.com>
CC: Daniel Vetter <daniel@...ll.ch>, David Airlie <airlied@...il.com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] drm/amd/pm: Replace 1-element arrays with flexible array
members
[Public]
> -----Original Message-----
> From: Samuel Holland <samuel.holland@...ive.com>
> Sent: Wednesday, August 30, 2023 2:58 PM
> To: Quan, Evan <Evan.Quan@....com>; Deucher, Alexander
> <Alexander.Deucher@....com>; Koenig, Christian
> <Christian.Koenig@....com>
> Cc: Samuel Holland <samuel.holland@...ive.com>; Daniel Vetter
> <daniel@...ll.ch>; David Airlie <airlied@...il.com>; Pan, Xinhui
> <Xinhui.Pan@....com>; amd-gfx@...ts.freedesktop.org; dri-
> devel@...ts.freedesktop.org; linux-kernel@...r.kernel.org
> Subject: [PATCH] drm/amd/pm: Replace 1-element arrays with flexible array
> members
>
> Since commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3"),
> UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. The
> bounds check is tripped in smu7_get_pp_table_entry_callback_func_v1(),
> while reading from mclk_dep_table.
>
> For consistency, fix all affected struct definitions in this file.
>
> Signed-off-by: Samuel Holland <samuel.holland@...ive.com>
+ Gustavo
Please make sure any code that uses these structures properly deals with the change in structure size.
Alex
> ---
>
> .../drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 20 +++++++++--------
> --
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h
> b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h
> index b0ac4d121adc..fb5e935ef786 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h
> @@ -164,7 +164,7 @@ typedef struct _ATOM_Tonga_State { typedef struct
> _ATOM_Tonga_State_Array {
> UCHAR ucRevId;
> UCHAR ucNumEntries; /* Number of entries. */
> - ATOM_Tonga_State entries[1]; /* Dynamically allocate entries. */
> + ATOM_Tonga_State entries[]; /* Dynamically allocate entries. */
> } ATOM_Tonga_State_Array;
>
> 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 {
> 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 { @@ -210,7
> +210,7 @@ typedef struct _ATOM_Polaris_SCLK_Dependency_Record {
> typedef struct _ATOM_Polaris_SCLK_Dependency_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> /* Number of entries. */
> - ATOM_Polaris_SCLK_Dependency_Record entries[1];
> /* Dynamically allocate entries. */
> + ATOM_Polaris_SCLK_Dependency_Record entries[];
> /* Dynamically allocate entries. */
> } ATOM_Polaris_SCLK_Dependency_Table;
>
> typedef struct _ATOM_Tonga_PCIE_Record { @@ -222,7 +222,7 @@ typedef
> struct _ATOM_Tonga_PCIE_Record { typedef struct
> _ATOM_Tonga_PCIE_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> /* Number of entries. */
> - ATOM_Tonga_PCIE_Record entries[1];
> /* Dynamically allocate entries. */
> + ATOM_Tonga_PCIE_Record entries[];
> /* Dynamically allocate entries. */
> } ATOM_Tonga_PCIE_Table;
>
> typedef struct _ATOM_Polaris10_PCIE_Record { @@ -235,7 +235,7 @@
> typedef struct _ATOM_Polaris10_PCIE_Record { typedef struct
> _ATOM_Polaris10_PCIE_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries; /* Number of entries. */
> - ATOM_Polaris10_PCIE_Record entries[1]; /* Dynamically
> allocate entries. */
> + ATOM_Polaris10_PCIE_Record entries[]; /* Dynamically
> allocate entries. */
> } ATOM_Polaris10_PCIE_Table;
>
>
> @@ -252,7 +252,7 @@ typedef struct
> _ATOM_Tonga_MM_Dependency_Record { typedef struct
> _ATOM_Tonga_MM_Dependency_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> /* Number of entries. */
> - ATOM_Tonga_MM_Dependency_Record entries[1];
> /* Dynamically allocate entries. */
> + ATOM_Tonga_MM_Dependency_Record entries[];
> /* Dynamically allocate entries. */
> } ATOM_Tonga_MM_Dependency_Table;
>
> typedef struct _ATOM_Tonga_Voltage_Lookup_Record { @@ -265,7 +265,7
> @@ typedef struct _ATOM_Tonga_Voltage_Lookup_Record { typedef struct
> _ATOM_Tonga_Voltage_Lookup_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> /* Number of entries. */
> - ATOM_Tonga_Voltage_Lookup_Record entries[1];
> /* Dynamically allocate entries. */
> + ATOM_Tonga_Voltage_Lookup_Record entries[];
> /* Dynamically allocate entries. */
> } ATOM_Tonga_Voltage_Lookup_Table;
>
> typedef struct _ATOM_Tonga_Fan_Table {
> @@ -367,7 +367,7 @@ typedef struct _ATOM_Tonga_VCE_State_Record {
> typedef struct _ATOM_Tonga_VCE_State_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> - ATOM_Tonga_VCE_State_Record entries[1];
> + ATOM_Tonga_VCE_State_Record entries[];
> } ATOM_Tonga_VCE_State_Table;
>
> typedef struct _ATOM_Tonga_PowerTune_Table { @@ -482,7 +482,7 @@
> typedef struct _ATOM_Tonga_Hard_Limit_Record { typedef struct
> _ATOM_Tonga_Hard_Limit_Table {
> UCHAR ucRevId;
> UCHAR ucNumEntries;
> - ATOM_Tonga_Hard_Limit_Record entries[1];
> + ATOM_Tonga_Hard_Limit_Record entries[];
> } ATOM_Tonga_Hard_Limit_Table;
>
> typedef struct _ATOM_Tonga_GPIO_Table {
> --
> 2.41.0
Powered by blists - more mailing lists