linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org
Subject: [PATCH][next] nfsd: Replace one-element array with flexible-array member
Date: Tue, 23 May 2023 18:44:23 -0600	[thread overview]
Message-ID: <ZG1d51tGG4c97qqb@work> (raw)

One-element arrays are deprecated, and we are replacing them with
flexible array members instead. So, replace a one-element array
with a flexible-arrayº member in struct vbi_anc_data and refactor
the rest of the code, accordingly.

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/298
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 fs/nfsd/nfs4callback.c | 2 +-
 fs/nfsd/xdr4.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 4039ffcf90ba..2c688d51135d 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -353,7 +353,7 @@ encode_cb_recallany4args(struct xdr_stream *xdr,
 {
 	encode_nfs_cb_opnum4(xdr, OP_CB_RECALL_ANY);
 	encode_uint32(xdr, ra->ra_keep);
-	encode_bitmap4(xdr, ra->ra_bmval, ARRAY_SIZE(ra->ra_bmval));
+	encode_bitmap4(xdr, ra->ra_bmval, 1);
 	hdr->nops++;
 }
 
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 510978e602da..68072170eac8 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -899,7 +899,7 @@ struct nfsd4_operation {
 struct nfsd4_cb_recall_any {
 	struct nfsd4_callback	ra_cb;
 	u32			ra_keep;
-	u32			ra_bmval[1];
+	u32			ra_bmval[];
 };
 
 #endif
-- 
2.34.1


             reply	other threads:[~2023-05-24  0:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  0:44 Gustavo A. R. Silva [this message]
2023-05-24  1:01 ` [PATCH][next] nfsd: Replace one-element array with flexible-array member Chuck Lever
2023-05-24  1:11   ` Gustavo A. R. Silva
2023-05-24  1:31     ` Chuck Lever
2023-05-24  1:42       ` 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=ZG1d51tGG4c97qqb@work \
    --to=gustavoars@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).