[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250708185815.6708-1-utkarsh.singh.em@gmail.com>
Date: Wed, 9 Jul 2025 00:28:16 +0530
From: Utkarsh Singh <utkarsh.singh.em@...il.com>
To: code@...icks.com
Cc: Utkarsh Singh <utkarsh.singh.em@...il.com>,
ecryptfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
brauner@...nel.org,
sandeen@...hat.com,
colin.i.king@...il.com,
david.hunter.linux@...il.com,
skhan@...uxfoundation.org
Subject: [PATCH] ecryptfs: use sysfs_emit() in version_show()
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@...il.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
Powered by blists - more mailing lists