From nobody Thu Oct 9 16:35:18 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64E241A262D; Mon, 16 Jun 2025 22:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750113068; cv=none; b=ASUq+k2fselhjHPsdqTq/j9bVxwkn1ac0flZBpLrgBIeh46nkx7rmhI7+6hqc5C663K7Gj9+zRZ1IJJmlxbOp4qCQVckprAbaDXtN2qA/Pv5DeivkFPNGu6zQy9uY43dv4LNxgwD5gOiEIYjk5fpDOGDh61OLxvMXlfJZhd3f+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750113068; c=relaxed/simple; bh=EkAFJcLPgPbjTKoUMNmizvrwNLp1j6JJOB4wBncDD1I=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=h4vlCxgtiHHxTYAlWWb53uJbKHGAWnsMNhOL4uUoT7/8iJKIzqEB888zD41N2nbxx154O/xdGPWMwUKiXhxZGcWrjfR/x9KYhIugxx51GY/UfpFrd44daaGjMPItxgge6lk4mMCOdyrEv1Uzm4IdpuDPKkUztVTql2iGDYOwuj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TkGFeU9p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TkGFeU9p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F033C4CEEA; Mon, 16 Jun 2025 22:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750113068; bh=EkAFJcLPgPbjTKoUMNmizvrwNLp1j6JJOB4wBncDD1I=; h=Date:From:To:Cc:Subject:From; b=TkGFeU9p/O3ay7cUOsigArUqUuE7ZDXE9F74E+EPJFM7VNOea1yKmiZAaAdVcG2hj /j3l7PNx/AGchLGgLyNSLuyNYUrP/FTwEz7M9W8xUr3CAOlj67mFFmM4vWETAPgfnf tr0gRArzeLvszG14SzhINBpderB36IgE/rllkk8Xfa6nYeCUrReAtJfXsI36DgnoYK jSzVIhdO+tznOxHQZ+QEDNUwdWoHEE6r2LefMGQ9L4TCXIECnNHOryg21LB1weTFW3 D9XX2aqBR5ZSCRp99GAAfJKk0Lh+Wn/lM0g1/WowKHRb4Q4u5qTo58tGC5pS10r1i0 517cI1i4cWAzA== Date: Mon, 16 Jun 2025 16:31:03 -0600 From: "Gustavo A. R. Silva" To: Chuck Lever , Jeff Layton , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH v3][next] NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 membe= r 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 memb= er 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 memb= er 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 memb= er 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 membe= r 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 membe= r is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva Reviewed-by: Jeff Layton Reviewed-by: NeilBrown --- 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]; }; }; }; --=20 2.43.0