[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250929130246.107478-3-mssola@mssola.com>
Date: Mon, 29 Sep 2025 15:02:46 +0200
From: Miquel Sabaté Solà <mssola@...ola.com>
To: linux-fsdevel@...r.kernel.org
Cc: miklos@...redi.hu,
linux-kernel@...r.kernel.org,
Miquel Sabaté Solà <mssola@...ola.com>
Subject: [PATCH v2 2/2] fs: fuse: rename 'namelen' to 'namesize'
By "length of a string" usually the number of non-null chars is
meant (i.e. strlen(str)). So the variable 'namelen' was confusingly
named, whereas 'namesize' refers more to what's being done in
'get_security_context'.
Suggested-by: Miklos Szeredi <miklos@...redi.hu>
Signed-off-by: Miquel Sabaté Solà <mssola@...ola.com>
---
fs/fuse/dir.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 3809e280b157..697be71de5a5 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -471,7 +471,7 @@ static int get_security_context(struct dentry *entry, umode_t mode,
u32 total_len = sizeof(*header);
int err, nr_ctx = 0;
const char *name = NULL;
- size_t namelen;
+ size_t namesize = 0;
err = security_dentry_init_security(entry, mode, &entry->d_name,
&name, &lsmctx);
@@ -482,12 +482,12 @@ static int get_security_context(struct dentry *entry, umode_t mode,
if (lsmctx.len) {
nr_ctx = 1;
- namelen = strlen(name) + 1;
+ namesize = strlen(name) + 1;
err = -EIO;
- if (WARN_ON(namelen > XATTR_NAME_MAX + 1 ||
+ if (WARN_ON(namesize > XATTR_NAME_MAX + 1 ||
lsmctx.len > S32_MAX))
goto out_err;
- total_len += FUSE_REC_ALIGN(sizeof(*fctx) + namelen +
+ total_len += FUSE_REC_ALIGN(sizeof(*fctx) + namesize +
lsmctx.len);
}
@@ -504,8 +504,8 @@ static int get_security_context(struct dentry *entry, umode_t mode,
fctx->size = lsmctx.len;
ptr += sizeof(*fctx);
- strscpy(ptr, name, namelen);
- ptr += namelen;
+ strscpy(ptr, name, namesize);
+ ptr += namesize;
memcpy(ptr, lsmctx.context, lsmctx.len);
}
--
2.51.0
Powered by blists - more mailing lists