From: Utkarsh Singh <utkarsh.singh.em@gmail.com>
To: code@tyhicks.com
Cc: Utkarsh Singh <utkarsh.singh.em@gmail.com>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
brauner@kernel.org, sandeen@redhat.com, colin.i.king@gmail.com,
david.hunter.linux@gmail.com, skhan@linuxfoundation.org
Subject: [PATCH] ecryptfs: use sysfs_emit() in version_show()
Date: Wed, 9 Jul 2025 00:28:16 +0530 [thread overview]
Message-ID: <20250708185815.6708-1-utkarsh.singh.em@gmail.com> (raw)
The sysfs_emit() helper is the preferred way to format sysfs attribute
output buffers. It provides consistent behavior and prevents potential
buffer overflows.
This patch replaces the use of snprintf() with sysfs_emit() in the
version_show() function.
Signed-off-by: Utkarsh Singh <utkarsh.singh.em@gmail.com>
---
fs/ecryptfs/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 8dd1d7189c3b..49b8024d6c64 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -764,7 +764,7 @@ static struct kobject *ecryptfs_kobj;
static ssize_t version_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buff)
{
- return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK);
+ return sysfs_emit(buff, "%d\n", ECRYPTFS_VERSIONING_MASK);
}
static struct kobj_attribute version_attr = __ATTR_RO(version);
--
2.34.1
reply other threads:[~2025-07-08 18:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250708185815.6708-1-utkarsh.singh.em@gmail.com \
--to=utkarsh.singh.em@gmail.com \
--cc=brauner@kernel.org \
--cc=code@tyhicks.com \
--cc=colin.i.king@gmail.com \
--cc=david.hunter.linux@gmail.com \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=skhan@linuxfoundation.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).