Skip to content

Commit

Permalink
netfilter: xt_IDLETIMER: replace snprintf in show functions with sysf…
Browse files Browse the repository at this point in the history
…s_emit

coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf

Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
sense.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yao <yao.jing2@zte.com.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Jing Yao authored and Pablo Neira Ayuso committed Nov 8, 2021
1 parent c95c078 commit c08d328
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/xt_IDLETIMER.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ static ssize_t idletimer_tg_show(struct device *dev,
mutex_unlock(&list_mutex);

if (time_after(expires, jiffies) || ktimespec.tv_sec > 0)
return snprintf(buf, PAGE_SIZE, "%ld\n", time_diff);
return sysfs_emit(buf, "%ld\n", time_diff);

return snprintf(buf, PAGE_SIZE, "0\n");
return sysfs_emit(buf, "0\n");
}

static void idletimer_tg_work(struct work_struct *work)
Expand Down

0 comments on commit c08d328

Please sign in to comment.