public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] dlm: Avoid -Wflex-array-member-not-at-end warning
@ 2025-09-22 14:20 Gustavo A. R. Silva
  2026-01-30  6:40 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2025-09-22 14:20 UTC (permalink / raw)
  To: Alexander Aring, David Teigland
  Cc: gfs2, 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 dlm_message` is a flexible
structure, this is a structure that contains a flexible-array
member.

Fix the following warning:

fs/dlm/dlm_internal.h:609:33: 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>
---
 fs/dlm/dlm_internal.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index d534a4bc162b..9df842421ae0 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -606,7 +606,6 @@ struct dlm_ls {
 
 	struct dlm_rsb		ls_local_rsb;	/* for returning errors */
 	struct dlm_lkb		ls_local_lkb;	/* for returning errors */
-	struct dlm_message	ls_local_ms;	/* for faking a reply */
 
 	struct dentry		*ls_debug_rsb_dentry; /* debugfs */
 	struct dentry		*ls_debug_waiters_dentry; /* debugfs */
@@ -665,6 +664,9 @@ struct dlm_ls {
 
 	int			ls_namelen;
 	char			ls_name[DLM_LOCKSPACE_LEN + 1];
+
+	/* Must be last --ends in a flexible-array member.*/
+	struct dlm_message	ls_local_ms;	/* for faking a reply */
 };
 
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] dlm: Avoid -Wflex-array-member-not-at-end warning
  2025-09-22 14:20 [PATCH][next] dlm: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2026-01-30  6:40 ` Gustavo A. R. Silva
  2026-01-31  1:17   ` Alexander Aring
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2026-01-30  6:40 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Alexander Aring, David Teigland
  Cc: gfs2, linux-kernel, linux-hardening

Hi all,

Who can take this, please?

Thanks
-Gustavo

On 9/22/25 23:20, 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 dlm_message` is a flexible
> structure, this is a structure that contains a flexible-array
> member.
> 
> Fix the following warning:
> 
> fs/dlm/dlm_internal.h:609:33: 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>
> ---
>   fs/dlm/dlm_internal.h | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
> index d534a4bc162b..9df842421ae0 100644
> --- a/fs/dlm/dlm_internal.h
> +++ b/fs/dlm/dlm_internal.h
> @@ -606,7 +606,6 @@ struct dlm_ls {
>   
>   	struct dlm_rsb		ls_local_rsb;	/* for returning errors */
>   	struct dlm_lkb		ls_local_lkb;	/* for returning errors */
> -	struct dlm_message	ls_local_ms;	/* for faking a reply */
>   
>   	struct dentry		*ls_debug_rsb_dentry; /* debugfs */
>   	struct dentry		*ls_debug_waiters_dentry; /* debugfs */
> @@ -665,6 +664,9 @@ struct dlm_ls {
>   
>   	int			ls_namelen;
>   	char			ls_name[DLM_LOCKSPACE_LEN + 1];
> +
> +	/* Must be last --ends in a flexible-array member.*/
> +	struct dlm_message	ls_local_ms;	/* for faking a reply */
>   };
>   
>   /*


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] dlm: Avoid -Wflex-array-member-not-at-end warning
  2026-01-30  6:40 ` Gustavo A. R. Silva
@ 2026-01-31  1:17   ` Alexander Aring
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Aring @ 2026-01-31  1:17 UTC (permalink / raw)
  To: Gustavo A. R. Silva, David Teigland
  Cc: Gustavo A. R. Silva, gfs2, linux-kernel, linux-hardening

Hi,

On Fri, Jan 30, 2026 at 4:43 PM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> Hi all,
>
> Who can take this, please?
>

Sorry, I will take care that it will be queued up for the next dlm pull-request.
I just checked again if the flexible array member can be accessed
under the current conditions, but I don't see this can be ever the
case... otherwise we would access garbage.

Thanks.

> Thanks
> -Gustavo
>
> On 9/22/25 23:20, 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 dlm_message` is a flexible
> > structure, this is a structure that contains a flexible-array
> > member.
> >
> > Fix the following warning:
> >
> > fs/dlm/dlm_internal.h:609:33: 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>

Acked-by: Alexander Aring <aahringo@redhat.com>

David Teigland can you please apply this patch to dlm/next so we don't
forget it.

Thanks

- Alex


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-31  1:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22 14:20 [PATCH][next] dlm: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2026-01-30  6:40 ` Gustavo A. R. Silva
2026-01-31  1:17   ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox