From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
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,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-hardening@vger.kernel.org, Kees Cook <kees@kernel.org>
Subject: [PATCH 2/5][next] nfsd: avoid -Wflex-array-member-not-at-end warnings
Date: Tue, 15 Oct 2024 18:29:31 -0600 [thread overview]
Message-ID: <9a04f3f766b2f8438887f6a003cf288d0f366fb8.1729037131.git.gustavoars@kernel.org> (raw)
In-Reply-To: <cover.1729037131.git.gustavoars@kernel.org>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.
Address the following warnings by changing the type of the middle struct
members in `struct nfsd_genl_rqstp`, which are currently causing trouble,
from `struct sockaddr` to `struct sockaddr_legacy`. Note that the latter
struct doesn't contain a flexible-array member.
fs/nfsd/nfsd.h:74:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
fs/nfsd/nfsd.h:75:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Also, update some related code, accordingly.
No binary differences are present after these changes.
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
fs/nfsd/nfsctl.c | 4 ++--
fs/nfsd/nfsd.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 3adbc05ebaac..884bfdc7a255 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1599,9 +1599,9 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
genl_rqstp.rq_stime = rqstp->rq_stime;
genl_rqstp.rq_opcnt = 0;
memcpy(&genl_rqstp.rq_daddr, svc_daddr(rqstp),
- sizeof(struct sockaddr));
+ sizeof(struct sockaddr_legacy));
memcpy(&genl_rqstp.rq_saddr, svc_addr(rqstp),
- sizeof(struct sockaddr));
+ sizeof(struct sockaddr_legacy));
#ifdef CONFIG_NFSD_V4
if (rqstp->rq_vers == NFS4_VERSION &&
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 004415651295..44be32510595 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -71,8 +71,8 @@ struct readdir_cd {
#define NFSD_MAX_OPS_PER_COMPOUND 50
struct nfsd_genl_rqstp {
- struct sockaddr rq_daddr;
- struct sockaddr rq_saddr;
+ struct sockaddr_legacy rq_daddr;
+ struct sockaddr_legacy rq_saddr;
unsigned long rq_flags;
ktime_t rq_stime;
__be32 rq_xid;
--
2.34.1
next prev parent reply other threads:[~2024-10-16 0:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 0:25 [PATCH 0/5][next] net: Avoid thousands of " Gustavo A. R. Silva
2024-10-16 0:27 ` [PATCH 1/5][next] net: dev: Introduce struct sockaddr_legacy Gustavo A. R. Silva
2024-10-16 3:30 ` Kuniyuki Iwashima
2024-10-22 17:07 ` Gustavo A. R. Silva
2024-10-22 12:13 ` David Laight
2024-10-22 17:30 ` Gustavo A. R. Silva
2024-10-16 0:29 ` Gustavo A. R. Silva [this message]
2024-10-16 14:16 ` [PATCH 2/5][next] nfsd: avoid -Wflex-array-member-not-at-end warnings Chuck Lever
2024-10-17 0:51 ` NeilBrown
2024-10-16 0:31 ` [PATCH 3/5][next] uapi: wireless: Avoid " Gustavo A. R. Silva
2024-10-16 9:06 ` Johannes Berg
2024-10-16 0:32 ` [PATCH 4/5][next] uapi: net: arp: " Gustavo A. R. Silva
2024-10-16 3:44 ` Kuniyuki Iwashima
2024-10-16 12:30 ` Andrew Lunn
2024-10-16 16:45 ` Kees Cook
2024-10-18 18:55 ` Gustavo A. R. Silva
2024-10-16 0:33 ` [PATCH 5/5][next] uapi: net: " Gustavo A. R. Silva
2024-10-16 3:51 ` Kuniyuki Iwashima
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=9a04f3f766b2f8438887f6a003cf288d0f366fb8.1729037131.git.gustavoars@kernel.org \
--to=gustavoars@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--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
all inboxes | Powered by JetHome®