From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-hardening@vger.kernel.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: [PATCH 00/14] drm/amd/pm: Replace one-element arrays with flexible-array members
Date: Wed, 7 Oct 2020 11:01:28 -0500 [thread overview]
Message-ID: <cover.1602020074.git.gustavoars@kernel.org> (raw)
Hi all,
This series aims to replace one-element arrays with flexible-array
members.
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].
Refactor the code according to the use of flexible-array members, instead
of one-element arrays, and use the struct_size() helper to calculate the
size for the dynamic memory allocation.
Also, save some heap space in the process. More on this on each individual
patch.
This series also addresses multiple of the following sorts of warnings:
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu8_hwmgr.c:1515:37:
warning: array subscript 1 is above array bounds of ‘const struct
phm_clock_voltage_dependency_record[1]’ [-Warray-bounds]
which, in this case, they are false positives, but nervertheless should be
fixed in order to enable -Warray-bounds[3][4].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays
[3] https://git.kernel.org/linus/44720996e2d79e47d508b0abe99b931a726a3197
[4] https://github.com/KSPP/linux/issues/109
Gustavo A. R. Silva (14):
drm/amd/pm: Replace one-element array with flexible-array member
drm/amd/pm: Replace one-element array with flexible-array member in
struct vi_dpm_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_clock_array
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_uvd_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_acp_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_phase_shedding_limits_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_vce_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_cac_leakage_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_samu_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_mm_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_voltage_lookup_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_pcie_table
drm/amd/pm: Replace one-element array with flexible-array in struct
ATOM_Vega10_GFXCLK_Dependency_Table
drivers/gpu/drm/amd/pm/inc/hwmgr.h | 20 ++---
.../drm/amd/pm/powerplay/hwmgr/hwmgr_ppt.h | 8 +-
.../powerplay/hwmgr/process_pptables_v1_0.c | 85 +++++++-----------
.../amd/pm/powerplay/hwmgr/processpptables.c | 85 +++++++-----------
.../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 2 +-
.../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 5 +-
.../amd/pm/powerplay/hwmgr/vega10_pptable.h | 2 +-
.../powerplay/hwmgr/vega10_processpptables.c | 88 ++++++-------------
8 files changed, 107 insertions(+), 188 deletions(-)
--
2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: "David Airlie" <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
amd-gfx@lists.freedesktop.org, linux-hardening@vger.kernel.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 00/14] drm/amd/pm: Replace one-element arrays with flexible-array members
Date: Wed, 7 Oct 2020 11:01:28 -0500 [thread overview]
Message-ID: <cover.1602020074.git.gustavoars@kernel.org> (raw)
Hi all,
This series aims to replace one-element arrays with flexible-array
members.
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].
Refactor the code according to the use of flexible-array members, instead
of one-element arrays, and use the struct_size() helper to calculate the
size for the dynamic memory allocation.
Also, save some heap space in the process. More on this on each individual
patch.
This series also addresses multiple of the following sorts of warnings:
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu8_hwmgr.c:1515:37:
warning: array subscript 1 is above array bounds of ‘const struct
phm_clock_voltage_dependency_record[1]’ [-Warray-bounds]
which, in this case, they are false positives, but nervertheless should be
fixed in order to enable -Warray-bounds[3][4].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays
[3] https://git.kernel.org/linus/44720996e2d79e47d508b0abe99b931a726a3197
[4] https://github.com/KSPP/linux/issues/109
Gustavo A. R. Silva (14):
drm/amd/pm: Replace one-element array with flexible-array member
drm/amd/pm: Replace one-element array with flexible-array member in
struct vi_dpm_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_clock_array
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_uvd_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_acp_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_phase_shedding_limits_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_vce_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_cac_leakage_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_samu_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_mm_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_voltage_lookup_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_pcie_table
drm/amd/pm: Replace one-element array with flexible-array in struct
ATOM_Vega10_GFXCLK_Dependency_Table
drivers/gpu/drm/amd/pm/inc/hwmgr.h | 20 ++---
.../drm/amd/pm/powerplay/hwmgr/hwmgr_ppt.h | 8 +-
.../powerplay/hwmgr/process_pptables_v1_0.c | 85 +++++++-----------
.../amd/pm/powerplay/hwmgr/processpptables.c | 85 +++++++-----------
.../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 2 +-
.../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 5 +-
.../amd/pm/powerplay/hwmgr/vega10_pptable.h | 2 +-
.../powerplay/hwmgr/vega10_processpptables.c | 88 ++++++-------------
8 files changed, 107 insertions(+), 188 deletions(-)
--
2.27.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: "David Airlie" <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
amd-gfx@lists.freedesktop.org, linux-hardening@vger.kernel.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 00/14] drm/amd/pm: Replace one-element arrays with flexible-array members
Date: Wed, 7 Oct 2020 11:01:28 -0500 [thread overview]
Message-ID: <cover.1602020074.git.gustavoars@kernel.org> (raw)
Hi all,
This series aims to replace one-element arrays with flexible-array
members.
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].
Refactor the code according to the use of flexible-array members, instead
of one-element arrays, and use the struct_size() helper to calculate the
size for the dynamic memory allocation.
Also, save some heap space in the process. More on this on each individual
patch.
This series also addresses multiple of the following sorts of warnings:
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu8_hwmgr.c:1515:37:
warning: array subscript 1 is above array bounds of ‘const struct
phm_clock_voltage_dependency_record[1]’ [-Warray-bounds]
which, in this case, they are false positives, but nervertheless should be
fixed in order to enable -Warray-bounds[3][4].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays
[3] https://git.kernel.org/linus/44720996e2d79e47d508b0abe99b931a726a3197
[4] https://github.com/KSPP/linux/issues/109
Gustavo A. R. Silva (14):
drm/amd/pm: Replace one-element array with flexible-array member
drm/amd/pm: Replace one-element array with flexible-array member in
struct vi_dpm_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_clock_array
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_uvd_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_acp_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_phase_shedding_limits_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_vce_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_cac_leakage_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_samu_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_mm_clock_voltage_dependency_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_voltage_lookup_table
drm/amd/pm: Replace one-element array with flexible-array in struct
phm_ppt_v1_pcie_table
drm/amd/pm: Replace one-element array with flexible-array in struct
ATOM_Vega10_GFXCLK_Dependency_Table
drivers/gpu/drm/amd/pm/inc/hwmgr.h | 20 ++---
.../drm/amd/pm/powerplay/hwmgr/hwmgr_ppt.h | 8 +-
.../powerplay/hwmgr/process_pptables_v1_0.c | 85 +++++++-----------
.../amd/pm/powerplay/hwmgr/processpptables.c | 85 +++++++-----------
.../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 2 +-
.../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 5 +-
.../amd/pm/powerplay/hwmgr/vega10_pptable.h | 2 +-
.../powerplay/hwmgr/vega10_processpptables.c | 88 ++++++-------------
8 files changed, 107 insertions(+), 188 deletions(-)
--
2.27.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2020-10-07 15:55 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 16:01 Gustavo A. R. Silva [this message]
2020-10-07 16:01 ` [PATCH 00/14] drm/amd/pm: Replace one-element arrays with flexible-array members Gustavo A. R. Silva
2020-10-07 16:01 ` Gustavo A. R. Silva
2020-10-07 16:02 ` [PATCH 01/14] drm/amd/pm: Replace one-element array with flexible-array member Gustavo A. R. Silva
2020-10-07 16:02 ` Gustavo A. R. Silva
2020-10-07 16:02 ` Gustavo A. R. Silva
2020-10-07 16:03 ` [PATCH 02/14] drm/amd/pm: Replace one-element array with flexible-array member in struct vi_dpm_table Gustavo A. R. Silva
2020-10-07 16:03 ` Gustavo A. R. Silva
2020-10-07 16:03 ` Gustavo A. R. Silva
2020-10-07 16:04 ` [PATCH 03/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_clock_array Gustavo A. R. Silva
2020-10-07 16:04 ` Gustavo A. R. Silva
2020-10-07 16:04 ` Gustavo A. R. Silva
2020-10-07 16:04 ` [PATCH 04/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_uvd_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:04 ` Gustavo A. R. Silva
2020-10-07 16:04 ` Gustavo A. R. Silva
2020-10-07 16:05 ` [PATCH 05/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_acp_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:05 ` Gustavo A. R. Silva
2020-10-07 16:05 ` Gustavo A. R. Silva
2020-10-07 16:06 ` [PATCH 06/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_phase_shedding_limits_table Gustavo A. R. Silva
2020-10-07 16:06 ` Gustavo A. R. Silva
2020-10-07 16:06 ` Gustavo A. R. Silva
2020-10-07 16:06 ` [PATCH 07/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_vce_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:06 ` Gustavo A. R. Silva
2020-10-07 16:06 ` Gustavo A. R. Silva
2020-10-07 16:07 ` [PATCH 08/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_cac_leakage_table Gustavo A. R. Silva
2020-10-07 16:07 ` Gustavo A. R. Silva
2020-10-07 16:07 ` Gustavo A. R. Silva
2020-10-07 16:08 ` [PATCH 09/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_samu_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:08 ` Gustavo A. R. Silva
2020-10-07 16:08 ` Gustavo A. R. Silva
2020-10-07 16:08 ` [PATCH 10/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_ppt_v1_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:08 ` Gustavo A. R. Silva
2020-10-07 16:08 ` Gustavo A. R. Silva
2020-10-07 16:09 ` [PATCH 11/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_ppt_v1_mm_clock_voltage_dependency_table Gustavo A. R. Silva
2020-10-07 16:09 ` Gustavo A. R. Silva
2020-10-07 16:09 ` Gustavo A. R. Silva
2020-10-07 16:10 ` [PATCH 12/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_ppt_v1_voltage_lookup_table Gustavo A. R. Silva
2020-10-07 16:10 ` Gustavo A. R. Silva
2020-10-07 16:10 ` Gustavo A. R. Silva
2020-10-07 16:10 ` [PATCH 13/14] drm/amd/pm: Replace one-element array with flexible-array in struct phm_ppt_v1_pcie_table Gustavo A. R. Silva
2020-10-07 16:10 ` Gustavo A. R. Silva
2020-10-07 16:10 ` Gustavo A. R. Silva
2020-10-07 16:11 ` [PATCH 14/14] drm/amd/pm: Replace one-element array with flexible-array in struct ATOM_Vega10_GFXCLK_Dependency_Table Gustavo A. R. Silva
2020-10-07 16:11 ` Gustavo A. R. Silva
2020-10-07 16:11 ` Gustavo A. R. Silva
2020-10-08 15:46 ` Alex Deucher
2020-10-08 15:46 ` Alex Deucher
2020-10-08 15:46 ` Alex Deucher
2020-10-08 7:19 ` [PATCH 00/14] drm/amd/pm: Replace one-element arrays with flexible-array members Christian König
2020-10-08 7:19 ` Christian König
2020-10-08 7:19 ` Christian König
2020-10-08 13:20 ` Gustavo A. R. Silva
2020-10-08 13:20 ` Gustavo A. R. Silva
2020-10-08 13:20 ` Gustavo A. R. Silva
2020-10-08 15:53 ` Alex Deucher
2020-10-08 15:53 ` Alex Deucher
2020-10-08 15:53 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1602020074.git.gustavoars@kernel.org \
--to=gustavoars@kernel.org \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.