Skip to content

Commit 84eab2a

Browse files
Qing WangJaegeuk Kim
authored andcommitted
f2fs: replace snprintf in show functions with sysfs_emit
coccicheck complains about the use of snprintf() in sysfs show functions. Fix the following coccicheck warning: fs/f2fs/sysfs.c:198:12-20: WARNING: use scnprintf or sprintf. fs/f2fs/sysfs.c:247:8-16: WARNING: use scnprintf or sprintf. Use sysfs_emit instead of scnprintf or sprintf makes more sense. Signed-off-by: Qing Wang <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 09631cf commit 84eab2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/f2fs/sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static ssize_t encoding_show(struct f2fs_attr *a,
196196
struct super_block *sb = sbi->sb;
197197

198198
if (f2fs_sb_has_casefold(sbi))
199-
return snprintf(buf, PAGE_SIZE, "%s (%d.%d.%d)\n",
199+
return sysfs_emit(buf, "%s (%d.%d.%d)\n",
200200
sb->s_encoding->charset,
201201
(sb->s_encoding->version >> 16) & 0xff,
202202
(sb->s_encoding->version >> 8) & 0xff,
@@ -245,7 +245,7 @@ static ssize_t avg_vblocks_show(struct f2fs_attr *a,
245245
static ssize_t main_blkaddr_show(struct f2fs_attr *a,
246246
struct f2fs_sb_info *sbi, char *buf)
247247
{
248-
return snprintf(buf, PAGE_SIZE, "%llu\n",
248+
return sysfs_emit(buf, "%llu\n",
249249
(unsigned long long)MAIN_BLKADDR(sbi));
250250
}
251251

0 commit comments

Comments
 (0)