From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
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,
Jeff Layton <jlayton@kernel.org>,
kernel test robot <lkp@intel.com>
Subject: [PATCH 1/2] nfsd: fix type mismatch and explain host-endian xdr buffer usage
Date: Mon, 03 Aug 2026 10:49:27 -0400 [thread overview]
Message-ID: <20260803-dir-deleg-v1-1-51be76861821@kernel.org> (raw)
In-Reply-To: <20260803-dir-deleg-v1-0-51be76861821@kernel.org>
sparse flagged this type mismatch. Also the xdr buffer usage is a bit
non-standard, so explain what we're doing and why.
Fixes: 4b64b811f368 ("nfsd: add notification handlers for dir events")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607310455.AT0GoC5j-lkp@intel.com/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/nfs4xdr.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index a47eb544b99f..5cbb4a415384 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -4383,13 +4383,18 @@ nfsd4_setup_notify_entry4(struct notify_entry4 *ne, struct xdr_stream *xdr,
struct path path = nf->nf_file->f_path;
struct nfsd4_fattr_args args = { };
const u32 *reqmask;
- uint32_t *attrmask;
+ u32 *attrmask;
__be32 status;
bool parent;
int ret;
- /* Reserve space for attrmask */
- attrmask = xdr_reserve_space(xdr, 3 * sizeof(uint32_t));
+ /*
+ * attrmask is the host-order bmval[3] that nfsd4_encode_attr_vals()
+ * consumes and that ne_attrs.attrmask.element points at. It must
+ * outlive this call, so steal a few words from the xdr stream to hold
+ * it.
+ */
+ attrmask = (u32 *)xdr_reserve_space(xdr, 3 * sizeof(*attrmask));
if (!attrmask)
return false;
--
2.55.0
next prev parent reply other threads:[~2026-08-03 14:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 14:49 [PATCH 0/2] nfsd: fix up some sparse warnings Jeff Layton
2026-08-03 14:49 ` Jeff Layton [this message]
2026-08-03 15:32 ` [PATCH 1/2] nfsd: fix type mismatch and explain host-endian xdr buffer usage Chuck Lever
2026-08-03 15:43 ` Jeff Layton
2026-08-03 16:04 ` Chuck Lever
2026-08-03 16:23 ` Jeff Layton
2026-08-03 18:33 ` Chuck Lever
2026-08-03 18:58 ` Jeff Layton
2026-08-03 14:49 ` [PATCH 2/2] nfsd: fix nfserr type in nfsd_lookup_dentry() Jeff Layton
2026-08-03 15:16 ` Chuck Lever
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=20260803-dir-deleg-v1-1-51be76861821@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=cel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=lkp@intel.com \
--cc=neil@brown.name \
--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