* [PATCH][next] drm/xe: Avoid dozens of -Wflex-array-member-not-at-end warnings
@ 2025-08-29 10:28 Gustavo A. R. Silva
2025-08-29 13:25 ` Lucas De Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2025-08-29 10:28 UTC (permalink / raw)
To: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter
Cc: intel-xe, dri-devel, 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.
Move the conflicting declaration to the end of the corresponding
structure. Notice that `struct dev_pagemap` is a flexible structure,
this is a structure that contains a flexible-array member.
Fix 56 of the following type of warnings:
drivers/gpu/drm/xe/xe_vram_types.h:69:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/gpu/drm/xe/xe_vram_types.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_vram_types.h b/drivers/gpu/drm/xe/xe_vram_types.h
index 83772dcbf1af..183d358da741 100644
--- a/drivers/gpu/drm/xe/xe_vram_types.h
+++ b/drivers/gpu/drm/xe/xe_vram_types.h
@@ -66,8 +66,6 @@ struct xe_vram_region {
#if IS_ENABLED(CONFIG_DRM_XE_PAGEMAP)
/** @migrate: Back pointer to migrate */
struct xe_migrate *migrate;
- /** @pagemap: Used to remap device memory as ZONE_DEVICE */
- struct dev_pagemap pagemap;
/**
* @dpagemap: The struct drm_pagemap of the ZONE_DEVICE memory
* pages of this tile.
@@ -79,6 +77,8 @@ struct xe_vram_region {
* This is generated when remap device memory as ZONE_DEVICE
*/
resource_size_t hpa_base;
+ /** @pagemap: Used to remap device memory as ZONE_DEVICE */
+ struct dev_pagemap pagemap;
#endif
};
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] drm/xe: Avoid dozens of -Wflex-array-member-not-at-end warnings
2025-08-29 10:28 [PATCH][next] drm/xe: Avoid dozens of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
@ 2025-08-29 13:25 ` Lucas De Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2025-08-29 13:25 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Thomas Hellström, Rodrigo Vivi, David Airlie, Simona Vetter,
intel-xe, dri-devel, linux-kernel, linux-hardening
On Fri, Aug 29, 2025 at 12:28:45PM +0200, 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.
>
>Move the conflicting declaration to the end of the corresponding
>structure. Notice that `struct dev_pagemap` is a flexible structure,
>this is a structure that contains a flexible-array member.
>
>Fix 56 of the following type of warnings:
>drivers/gpu/drm/xe/xe_vram_types.h:69:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
should this patch be together with actually enabling the warning (at
least locally in xe) so we don't re-introduce it? From the user side
it's not obvious that dev_pagemap itself contains an array so it can
only be embedded at the end.
Lucas De Marchi
>
>Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>---
> drivers/gpu/drm/xe/xe_vram_types.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_vram_types.h b/drivers/gpu/drm/xe/xe_vram_types.h
>index 83772dcbf1af..183d358da741 100644
>--- a/drivers/gpu/drm/xe/xe_vram_types.h
>+++ b/drivers/gpu/drm/xe/xe_vram_types.h
>@@ -66,8 +66,6 @@ struct xe_vram_region {
> #if IS_ENABLED(CONFIG_DRM_XE_PAGEMAP)
> /** @migrate: Back pointer to migrate */
> struct xe_migrate *migrate;
>- /** @pagemap: Used to remap device memory as ZONE_DEVICE */
>- struct dev_pagemap pagemap;
> /**
> * @dpagemap: The struct drm_pagemap of the ZONE_DEVICE memory
> * pages of this tile.
>@@ -79,6 +77,8 @@ struct xe_vram_region {
> * This is generated when remap device memory as ZONE_DEVICE
> */
> resource_size_t hpa_base;
>+ /** @pagemap: Used to remap device memory as ZONE_DEVICE */
>+ struct dev_pagemap pagemap;
> #endif
> };
>
>--
>2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-29 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 10:28 [PATCH][next] drm/xe: Avoid dozens of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-08-29 13:25 ` Lucas De Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).