]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs/ecryptfs: replace snprintf with sysfs_emit in show function
authorAnkit Chauhan <ankitchauhan2065@gmail.com>
Thu, 19 Jun 2025 03:15:36 +0000 (08:45 +0530)
committerChristian Brauner <brauner@kernel.org>
Mon, 23 Jun 2025 12:12:36 +0000 (14:12 +0200)
Use sysfs_emit() instead of snprintf() in version_show() function to
follow the preferred kernel API.

Signed-off-by: Ankit Chauhan <ankitchauhan2065@gmail.com>
Link: https://lore.kernel.org/20250619031536.19352-1-ankitchauhan2065@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ecryptfs/main.c

index 8dd1d7189c3b2e7876b1fe86897a7773f6e8733f..0db21e592fe70359cb7edb6f2b699519e3e3b8ad 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/fs_context.h>
 #include <linux/fs_parser.h>
 #include <linux/fs_stack.h>
+#include <linux/sysfs.h>
 #include <linux/slab.h>
 #include <linux/magic.h>
 #include "ecryptfs_kernel.h"
@@ -764,7 +765,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);