[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFCbJ7mKFOzJ8VZ6@kspp>
Date: Mon, 16 Jun 2025 16:31:03 -0600
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Chuck Lever <chuck.lever@...cle.com>, Jeff Layton <jlayton@...nel.org>,
NeilBrown <neil@...wn.name>,
Olga Kornievskaia <okorniev@...hat.com>,
Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey <tom@...pey.com>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-hardening@...r.kernel.org
Subject: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end
warnings
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@...nel.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
Powered by blists - more mailing lists