[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250616110313.372314-1-pranav.tyagi03@gmail.com>
Date: Mon, 16 Jun 2025 16:33:13 +0530
From: Pranav Tyagi <pranav.tyagi03@...il.com>
To: cem@...nel.org
Cc: skhan@...uxfoundation.org,
linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linux.dev,
Pranav Tyagi <pranav.tyagi03@...il.com>
Subject: [PATCH] fs/xfs: use scnprintf() in show functions
Replace all snprintf() instances with scnprintf(). snprintf() returns
the number of bytes that would have been written had there been enough
space. For sysfs attributes, snprintf() should not be used for the
show() method. Instead use scnprintf() which returns the number of bytes
actually written.
Signed-off-by: Pranav Tyagi <pranav.tyagi03@...il.com>
---
fs/xfs/xfs_sysfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 7a5c5ef2db92..f7206e3edea2 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -257,7 +257,7 @@ larp_show(
struct kobject *kobject,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.larp);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.larp);
}
XFS_SYSFS_ATTR_RW(larp);
@@ -283,7 +283,7 @@ bload_leaf_slack_show(
struct kobject *kobject,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bload_leaf_slack);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bload_leaf_slack);
}
XFS_SYSFS_ATTR_RW(bload_leaf_slack);
@@ -309,7 +309,7 @@ bload_node_slack_show(
struct kobject *kobject,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bload_node_slack);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bload_node_slack);
}
XFS_SYSFS_ATTR_RW(bload_node_slack);
--
2.49.0
Powered by blists - more mailing lists