On Tue, 2021-10-12 at 20:29 -0700, Qing Wang wrote: > coccicheck complains about the use of snprintf() in sysfs show functions. > > Fix the coccicheck warning: > WARNING: use scnprintf or sprintf. > > Use sysfs_emit instead of scnprintf or sprintf makes more sense. [] > diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c [] > @@ -104,7 +104,7 @@ bug_on_assert_show( > struct kobject *kobject, > char *buf) > { > - return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bug_on_assert ? 1 : 0); > + return sysfs_emit(buf, "%d\n", xfs_globals.bug_on_assert ? 1 : 0); trivia: The ?: is not necessary as xfs_globals.bug_on_assert is a bool and would have an implicit cast done. return sysfs_emit(buf, "%d\n", xfs_globals.bug_on_assert);