Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/ecryptfs: replace snprintf with sysfs_emit in show function

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>

authored by

Ankit Chauhan and committed by
Christian Brauner
06a70535 2b7c9664

+2 -1
+2 -1
fs/ecryptfs/main.c
··· 20 20 #include <linux/fs_context.h> 21 21 #include <linux/fs_parser.h> 22 22 #include <linux/fs_stack.h> 23 + #include <linux/sysfs.h> 23 24 #include <linux/slab.h> 24 25 #include <linux/magic.h> 25 26 #include "ecryptfs_kernel.h" ··· 765 764 static ssize_t version_show(struct kobject *kobj, 766 765 struct kobj_attribute *attr, char *buff) 767 766 { 768 - return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK); 767 + return sysfs_emit(buff, "%d\n", ECRYPTFS_VERSIONING_MASK); 769 768 } 770 769 771 770 static struct kobj_attribute version_attr = __ATTR_RO(version);