From: Jeff Layton <jlayton@kernel.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings
Date: Tue, 17 Jun 2025 06:57:15 -0400 [thread overview]
Message-ID: <0ce7c86caaa57d879ef85471414f80692212a6c6.camel@kernel.org> (raw)
In-Reply-To: <aFCbJ7mKFOzJ8VZ6@kspp>
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>
next prev parent reply other threads:[~2025-06-17 10:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2025-06-17 13:48 ` Chuck Lever
2025-06-17 19:14 ` Gustavo A. R. Silva
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=0ce7c86caaa57d879ef85471414f80692212a6c6.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=gustavoars@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox