* [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
@ 2025-08-14 6:01 Gustavo A. R. Silva
2025-09-15 23:06 ` Justin Stitt
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2025-08-14 6:01 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter
Cc: dri-devel, nouveau, linux-kernel, Gustavo A. R. Silva,
linux-hardening
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.
Use the new TRAILING_OVERLAP() helper to fix the following warning:
drivers/gpu/drm/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
This helper creates a union between a flexible-array member (FAM)
and a set of members that would otherwise follow it. This overlays
the trailing members onto the FAM while preserving the original
memory layout.
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
Changes in v3:
- Use the new TRAILING_OVERLAP() helper.
Changes in v2:
- Adjust heap allocation.
drivers/gpu/drm/nouveau/nvif/fifo.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvif/fifo.c b/drivers/gpu/drm/nouveau/nvif/fifo.c
index a463289962b2..b0ab80995d98 100644
--- a/drivers/gpu/drm/nouveau/nvif/fifo.c
+++ b/drivers/gpu/drm/nouveau/nvif/fifo.c
@@ -25,13 +25,12 @@ static int
nvif_fifo_runlists(struct nvif_device *device)
{
struct nvif_object *object = &device->object;
- struct {
- struct nv_device_info_v1 m;
+ TRAILING_OVERLAP(struct nv_device_info_v1, m, data,
struct {
struct nv_device_info_v1_data runlists;
struct nv_device_info_v1_data runlist[64];
} v;
- } *a;
+ ) *a;
int ret, i;
if (device->runlist)
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2025-08-14 6:01 [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2025-09-15 23:06 ` Justin Stitt
2026-01-06 6:08 ` Gustavo A. R. Silva
2026-01-06 19:59 ` Kees Cook
2 siblings, 0 replies; 10+ messages in thread
From: Justin Stitt @ 2025-09-15 23:06 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter,
dri-devel, nouveau, linux-kernel, linux-hardening
Hi,
On Thu, Aug 14, 2025 at 03:01:07PM +0900, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> Use the new TRAILING_OVERLAP() helper to fix the following warning:
>
> drivers/gpu/drm/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> This helper creates a union between a flexible-array member (FAM)
> and a set of members that would otherwise follow it. This overlays
> the trailing members onto the FAM while preserving the original
> memory layout.
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
I took a look at the modified structure layout with the union from the
macro using pahole and found the layouts and sizes to be equivalent --
all the while fixing the warning you demonstrated.
Reviewed-by: Justin Stitt <justinstitt@google.com>
> ---
> Changes in v3:
> - Use the new TRAILING_OVERLAP() helper.
There's really starting to be a lot of these helper macros!
>
> Changes in v2:
> - Adjust heap allocation.
>
> drivers/gpu/drm/nouveau/nvif/fifo.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvif/fifo.c b/drivers/gpu/drm/nouveau/nvif/fifo.c
> index a463289962b2..b0ab80995d98 100644
> --- a/drivers/gpu/drm/nouveau/nvif/fifo.c
> +++ b/drivers/gpu/drm/nouveau/nvif/fifo.c
> @@ -25,13 +25,12 @@ static int
> nvif_fifo_runlists(struct nvif_device *device)
> {
> struct nvif_object *object = &device->object;
> - struct {
> - struct nv_device_info_v1 m;
> + TRAILING_OVERLAP(struct nv_device_info_v1, m, data,
> struct {
> struct nv_device_info_v1_data runlists;
> struct nv_device_info_v1_data runlist[64];
> } v;
> - } *a;
> + ) *a;
> int ret, i;
>
> if (device->runlist)
> --
> 2.43.0
>
>
Thanks
Justin
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2025-08-14 6:01 [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-09-15 23:06 ` Justin Stitt
@ 2026-01-06 6:08 ` Gustavo A. R. Silva
2026-01-06 20:14 ` Danilo Krummrich
2026-01-06 19:59 ` Kees Cook
2 siblings, 1 reply; 10+ messages in thread
From: Gustavo A. R. Silva @ 2026-01-06 6:08 UTC (permalink / raw)
To: Gustavo A. R. Silva, Lyude Paul, Danilo Krummrich, David Airlie,
Simona Vetter
Cc: dri-devel, nouveau, linux-kernel, linux-hardening
Hi all,
Friendly ping: who can take this, please?
Thanks
-Gustavo
On 8/14/25 15:01, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> Use the new TRAILING_OVERLAP() helper to fix the following warning:
>
> drivers/gpu/drm/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> This helper creates a union between a flexible-array member (FAM)
> and a set of members that would otherwise follow it. This overlays
> the trailing members onto the FAM while preserving the original
> memory layout.
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> Changes in v3:
> - Use the new TRAILING_OVERLAP() helper.
>
> Changes in v2:
> - Adjust heap allocation.
>
> drivers/gpu/drm/nouveau/nvif/fifo.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvif/fifo.c b/drivers/gpu/drm/nouveau/nvif/fifo.c
> index a463289962b2..b0ab80995d98 100644
> --- a/drivers/gpu/drm/nouveau/nvif/fifo.c
> +++ b/drivers/gpu/drm/nouveau/nvif/fifo.c
> @@ -25,13 +25,12 @@ static int
> nvif_fifo_runlists(struct nvif_device *device)
> {
> struct nvif_object *object = &device->object;
> - struct {
> - struct nv_device_info_v1 m;
> + TRAILING_OVERLAP(struct nv_device_info_v1, m, data,
> struct {
> struct nv_device_info_v1_data runlists;
> struct nv_device_info_v1_data runlist[64];
> } v;
> - } *a;
> + ) *a;
> int ret, i;
>
> if (device->runlist)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2026-01-06 6:08 ` Gustavo A. R. Silva
@ 2026-01-06 20:14 ` Danilo Krummrich
0 siblings, 0 replies; 10+ messages in thread
From: Danilo Krummrich @ 2026-01-06 20:14 UTC (permalink / raw)
To: Gustavo A. R. Silva, Kees Cook
Cc: Gustavo A. R. Silva, Lyude Paul, David Airlie, Simona Vetter,
dri-devel, nouveau, linux-kernel, linux-hardening
On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
> Friendly ping: who can take this, please?
For some reason this patch wasn't tagged for applying in my inbox -- seems like
it slipped through.
I was about to pick it up, but recognized just in time that Kees already took it
through his hardening tree.
Sorry for the delay; thanks Kees for picking it up. Even though already applied,
please consider this patch:
Acked-by: Danilo Krummrich <dakr@kernel.org>
Thanks,
Danilo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
@ 2026-01-06 20:14 ` Danilo Krummrich
0 siblings, 0 replies; 10+ messages in thread
From: Danilo Krummrich @ 2026-01-06 20:14 UTC (permalink / raw)
To: Gustavo A. R. Silva, Kees Cook
Cc: Gustavo A. R. Silva, Simona Vetter, dri-devel, nouveau,
linux-kernel, linux-hardening
On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
> Friendly ping: who can take this, please?
For some reason this patch wasn't tagged for applying in my inbox -- seems like
it slipped through.
I was about to pick it up, but recognized just in time that Kees already took it
through his hardening tree.
Sorry for the delay; thanks Kees for picking it up. Even though already applied,
please consider this patch:
Acked-by: Danilo Krummrich <dakr@kernel.org>
Thanks,
Danilo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2026-01-06 20:14 ` Danilo Krummrich
@ 2026-01-06 20:21 ` Kees Cook
-1 siblings, 0 replies; 10+ messages in thread
From: Kees Cook @ 2026-01-06 20:21 UTC (permalink / raw)
To: Danilo Krummrich
Cc: Gustavo A. R. Silva, Gustavo A. R. Silva, Lyude Paul,
David Airlie, Simona Vetter, dri-devel, nouveau, linux-kernel,
linux-hardening
On Tue, Jan 06, 2026 at 09:14:36PM +0100, Danilo Krummrich wrote:
> On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
> > Friendly ping: who can take this, please?
> For some reason this patch wasn't tagged for applying in my inbox -- seems like
> it slipped through.
>
> I was about to pick it up, but recognized just in time that Kees already took it
> through his hardening tree.
Ah great!
> Sorry for the delay; thanks Kees for picking it up. Even though already applied,
> please consider this patch:
>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
Thanks! I had figured it was slipping through the cracks so I snagged
it. I'll add your Ack. :) If you'd rather take it, just say the word and
I can drop it from my tree.
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
@ 2026-01-06 20:21 ` Kees Cook
0 siblings, 0 replies; 10+ messages in thread
From: Kees Cook @ 2026-01-06 20:21 UTC (permalink / raw)
To: Danilo Krummrich
Cc: Gustavo A. R. Silva, Gustavo A. R. Silva, Simona Vetter,
dri-devel, nouveau, linux-kernel, linux-hardening
On Tue, Jan 06, 2026 at 09:14:36PM +0100, Danilo Krummrich wrote:
> On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
> > Friendly ping: who can take this, please?
> For some reason this patch wasn't tagged for applying in my inbox -- seems like
> it slipped through.
>
> I was about to pick it up, but recognized just in time that Kees already took it
> through his hardening tree.
Ah great!
> Sorry for the delay; thanks Kees for picking it up. Even though already applied,
> please consider this patch:
>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
Thanks! I had figured it was slipping through the cracks so I snagged
it. I'll add your Ack. :) If you'd rather take it, just say the word and
I can drop it from my tree.
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2026-01-06 20:21 ` Kees Cook
@ 2026-01-07 6:35 ` Gustavo A. R. Silva
-1 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2026-01-07 6:35 UTC (permalink / raw)
To: Kees Cook, Danilo Krummrich
Cc: Gustavo A. R. Silva, Lyude Paul, David Airlie, Simona Vetter,
dri-devel, nouveau, linux-kernel, linux-hardening
On 1/7/26 05:21, Kees Cook wrote:
> On Tue, Jan 06, 2026 at 09:14:36PM +0100, Danilo Krummrich wrote:
>> On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
>>> Friendly ping: who can take this, please?
>> For some reason this patch wasn't tagged for applying in my inbox -- seems like
>> it slipped through.
>>
>> I was about to pick it up, but recognized just in time that Kees already took it
>> through his hardening tree.
>
> Ah great!
>
>> Sorry for the delay; thanks Kees for picking it up. Even though already applied,
>> please consider this patch:
>>
>> Acked-by: Danilo Krummrich <dakr@kernel.org>
>
> Thanks! I had figured it was slipping through the cracks so I snagged
> it. I'll add your Ack. :) If you'd rather take it, just say the word and
> I can drop it from my tree.
Thank you both!
-Gustavo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
@ 2026-01-07 6:35 ` Gustavo A. R. Silva
0 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2026-01-07 6:35 UTC (permalink / raw)
To: Kees Cook, Danilo Krummrich
Cc: Gustavo A. R. Silva, Simona Vetter, dri-devel, nouveau,
linux-kernel, linux-hardening
On 1/7/26 05:21, Kees Cook wrote:
> On Tue, Jan 06, 2026 at 09:14:36PM +0100, Danilo Krummrich wrote:
>> On 1/6/26 7:08 AM, Gustavo A. R. Silva wrote:
>>> Friendly ping: who can take this, please?
>> For some reason this patch wasn't tagged for applying in my inbox -- seems like
>> it slipped through.
>>
>> I was about to pick it up, but recognized just in time that Kees already took it
>> through his hardening tree.
>
> Ah great!
>
>> Sorry for the delay; thanks Kees for picking it up. Even though already applied,
>> please consider this patch:
>>
>> Acked-by: Danilo Krummrich <dakr@kernel.org>
>
> Thanks! I had figured it was slipping through the cracks so I snagged
> it. I'll add your Ack. :) If you'd rather take it, just say the word and
> I can drop it from my tree.
Thank you both!
-Gustavo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
2025-08-14 6:01 [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-09-15 23:06 ` Justin Stitt
2026-01-06 6:08 ` Gustavo A. R. Silva
@ 2026-01-06 19:59 ` Kees Cook
2 siblings, 0 replies; 10+ messages in thread
From: Kees Cook @ 2026-01-06 19:59 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter,
Gustavo A. R. Silva
Cc: Kees Cook, dri-devel, nouveau, linux-kernel, linux-hardening
On Thu, 14 Aug 2025 15:01:07 +0900, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> Use the new TRAILING_OVERLAP() helper to fix the following warning:
>
> drivers/gpu/drm/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
https://git.kernel.org/kees/c/2d4909bae919
Take care,
--
Kees Cook
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-01-07 6:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 6:01 [PATCH v3][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-09-15 23:06 ` Justin Stitt
2026-01-06 6:08 ` Gustavo A. R. Silva
2026-01-06 20:14 ` Danilo Krummrich
2026-01-06 20:14 ` Danilo Krummrich
2026-01-06 20:21 ` Kees Cook
2026-01-06 20:21 ` Kees Cook
2026-01-07 6:35 ` Gustavo A. R. Silva
2026-01-07 6:35 ` Gustavo A. R. Silva
2026-01-06 19:59 ` Kees Cook
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.