* [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
@ 2025-06-16 22:31 Gustavo A. R. Silva
2025-06-17 1:29 ` NeilBrown
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2025-06-16 22:31 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo,
Tom Talpey
Cc: linux-nfs, linux-kernel, Gustavo A. R. Silva, linux-hardening
Replace flexible-array member with a fixed-size array.
With this changes, fix many instances of the following type of
warnings:
fs/nfsd/nfsfh.h:79:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/state.h:763:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/state.h:669:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/state.h:549:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/xdr4.h:705:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/xdr4.h:678: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>
---
Changes in v3:
- Replace flexible-array member with a fixed-size array. (NeilBrown)
Changes in v2:
- Use indices into `fh_raw`. (Christoph)
- Remove union and flexible-array member `fh_fsid`. (Christoph)
- Link: https://lore.kernel.org/linux-hardening/aEoKCuQ1YDs2Ivn0@kspp/
v1:
- Link: https://lore.kernel.org/linux-hardening/aBp37ZXBJM09yAXp@kspp/
fs/nfsd/nfsfh.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index 5103c2f4d225..760e77f3630b 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -56,7 +56,7 @@ struct knfsd_fh {
u8 fh_auth_type; /* deprecated */
u8 fh_fsid_type;
u8 fh_fileid_type;
- u32 fh_fsid[]; /* flexible-array member */
+ u32 fh_fsid[NFS4_FHSIZE / 4 - 1];
};
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
2025-06-16 22:31 [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
@ 2025-06-17 1:29 ` NeilBrown
2025-06-17 10:57 ` Jeff Layton
2025-06-17 13:48 ` Chuck Lever
2 siblings, 0 replies; 5+ messages in thread
From: NeilBrown @ 2025-06-17 1:29 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Chuck Lever, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
linux-nfs, linux-kernel, Gustavo A. R. Silva, linux-hardening
On Tue, 17 Jun 2025, Gustavo A. R. Silva wrote:
> Replace flexible-array member with a fixed-size array.
>
> With this changes, fix many instances of the following type of
> warnings:
>
> fs/nfsd/nfsfh.h:79:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:763:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:669:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:549:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:705:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:678: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>
> ---
> Changes in v3:
> - Replace flexible-array member with a fixed-size array. (NeilBrown)
>
> Changes in v2:
> - Use indices into `fh_raw`. (Christoph)
> - Remove union and flexible-array member `fh_fsid`. (Christoph)
> - Link: https://lore.kernel.org/linux-hardening/aEoKCuQ1YDs2Ivn0@kspp/
>
> v1:
> - Link: https://lore.kernel.org/linux-hardening/aBp37ZXBJM09yAXp@kspp/
>
> fs/nfsd/nfsfh.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index 5103c2f4d225..760e77f3630b 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -56,7 +56,7 @@ struct knfsd_fh {
> u8 fh_auth_type; /* deprecated */
> u8 fh_fsid_type;
> u8 fh_fileid_type;
> - u32 fh_fsid[]; /* flexible-array member */
> + u32 fh_fsid[NFS4_FHSIZE / 4 - 1];
> };
Thanks. I think this is a good and simple solution.
Reviewed-by: NeilBrown <neil@brown.name>
> };
> };
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
2025-06-16 22:31 [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-06-17 1:29 ` NeilBrown
@ 2025-06-17 10:57 ` Jeff Layton
2025-06-17 13:48 ` Chuck Lever
2 siblings, 0 replies; 5+ messages in thread
From: Jeff Layton @ 2025-06-17 10:57 UTC (permalink / raw)
To: Gustavo A. R. Silva, Chuck Lever, NeilBrown, Olga Kornievskaia,
Dai Ngo, Tom Talpey
Cc: linux-nfs, linux-kernel, linux-hardening
On Mon, 2025-06-16 at 16:31 -0600, Gustavo A. R. Silva wrote:
> Replace flexible-array member with a fixed-size array.
>
> With this changes, fix many instances of the following type of
> warnings:
>
> fs/nfsd/nfsfh.h:79:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:763:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:669:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:549:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:705:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:678: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>
> ---
> Changes in v3:
> - Replace flexible-array member with a fixed-size array. (NeilBrown)
>
> Changes in v2:
> - Use indices into `fh_raw`. (Christoph)
> - Remove union and flexible-array member `fh_fsid`. (Christoph)
> - Link: https://lore.kernel.org/linux-hardening/aEoKCuQ1YDs2Ivn0@kspp/
>
> v1:
> - Link: https://lore.kernel.org/linux-hardening/aBp37ZXBJM09yAXp@kspp/
>
> fs/nfsd/nfsfh.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index 5103c2f4d225..760e77f3630b 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -56,7 +56,7 @@ struct knfsd_fh {
> u8 fh_auth_type; /* deprecated */
> u8 fh_fsid_type;
> u8 fh_fileid_type;
> - u32 fh_fsid[]; /* flexible-array member */
> + u32 fh_fsid[NFS4_FHSIZE / 4 - 1];
> };
> };
> };
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
2025-06-16 22:31 [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-06-17 1:29 ` NeilBrown
2025-06-17 10:57 ` Jeff Layton
@ 2025-06-17 13:48 ` Chuck Lever
2025-06-17 19:14 ` Gustavo A. R. Silva
2 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2025-06-17 13:48 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Gustavo A. R. Silva
Cc: Chuck Lever, linux-nfs, linux-kernel, linux-hardening
From: Chuck Lever <chuck.lever@oracle.com>
On Mon, 16 Jun 2025 16:31:03 -0600, Gustavo A. R. Silva wrote:
> Replace flexible-array member with a fixed-size array.
>
> With this changes, fix many instances of the following type of
> warnings:
>
> fs/nfsd/nfsfh.h:79:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:763:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:669:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/state.h:549:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:705:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> fs/nfsd/xdr4.h:678:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> [...]
Applied to nfsd-testing, thanks!
[1/1] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
commit: 9aa83533d2e694c84d7d09f9c8eab29ad9f2adef
--
Chuck Lever
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
2025-06-17 13:48 ` Chuck Lever
@ 2025-06-17 19:14 ` Gustavo A. R. Silva
0 siblings, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2025-06-17 19:14 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo,
Tom Talpey, Gustavo A. R. Silva
Cc: Chuck Lever, linux-nfs, linux-kernel, linux-hardening
> Applied to nfsd-testing, thanks!
>
> [1/1] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
> commit: 9aa83533d2e694c84d7d09f9c8eab29ad9f2adef
>
Thank you, folks! :)
-Gustavo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-17 19:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 22:31 [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-06-17 1:29 ` NeilBrown
2025-06-17 10:57 ` Jeff Layton
2025-06-17 13:48 ` Chuck Lever
2025-06-17 19:14 ` Gustavo A. R. Silva
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.