* [PATCH] ecryptfs: use sysfs_emit() in version_show()
@ 2025-07-08 18:58 Utkarsh Singh
0 siblings, 0 replies; only message in thread
From: Utkarsh Singh @ 2025-07-08 18:58 UTC (permalink / raw)
To: code
Cc: Utkarsh Singh, ecryptfs, linux-kernel, brauner, sandeen,
colin.i.king, david.hunter.linux, skhan
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-08 18:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 18:58 [PATCH] ecryptfs: use sysfs_emit() in version_show() Utkarsh Singh
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).