From: Thorsten Blum <thorsten.blum@toblux.com>
To: anna@kernel.org, jlayton@kernel.org, bcodding@redhat.com,
kolga@netapp.com, josef@toxicpanda.com, gustavoars@kernel.org,
kees@kernel.org
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org,
Thorsten Blum <thorsten.blum@toblux.com>
Subject: [PATCH] NFS/flexfiles: Replace one-element array with flexible-array member
Date: Sat, 17 Aug 2024 16:20:23 +0200 [thread overview]
Message-ID: <20240817142022.68411-2-thorsten.blum@toblux.com> (raw)
Replace the deprecated one-element array with a modern flexible-array
member in the struct nfs4_flexfile_layoutreturn_args.
Adjust the struct size accordingly.
There are no binary differences after this conversion.
Link: https://github.com/KSPP/linux/issues/79
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 2 +-
fs/nfs/flexfilelayout/flexfilelayout.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 39ba9f4208aa..fc698fa9aaea 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -2224,7 +2224,7 @@ ff_layout_prepare_layoutreturn(struct nfs4_layoutreturn_args *args)
struct nfs4_flexfile_layoutreturn_args *ff_args;
struct nfs4_flexfile_layout *ff_layout = FF_LAYOUT_FROM_HDR(args->layout);
- ff_args = kmalloc(sizeof(*ff_args), nfs_io_gfp_mask());
+ ff_args = kmalloc(struct_size(ff_args, pages, 1), nfs_io_gfp_mask());
if (!ff_args)
goto out_nomem;
ff_args->pages[0] = alloc_page(nfs_io_gfp_mask());
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index f84b3fb0dddd..a269753f9a46 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -115,7 +115,7 @@ struct nfs4_flexfile_layoutreturn_args {
struct nfs42_layoutstat_devinfo devinfo[FF_LAYOUTSTATS_MAXDEV];
unsigned int num_errors;
unsigned int num_dev;
- struct page *pages[1];
+ struct page *pages[];
};
static inline struct nfs4_flexfile_layout *
--
2.46.0
next reply other threads:[~2024-08-17 14:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-17 14:20 Thorsten Blum [this message]
2024-08-17 20:40 ` Trond Myklebust
2024-08-17 21:17 ` Thorsten Blum
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=20240817142022.68411-2-thorsten.blum@toblux.com \
--to=thorsten.blum@toblux.com \
--cc=anna@kernel.org \
--cc=bcodding@redhat.com \
--cc=gustavoars@kernel.org \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kees@kernel.org \
--cc=kolga@netapp.com \
--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
all inboxes | Powered by JetHome®