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

netfilter: xt_IDLETIMER: replace snprintf in show functions with sysfs_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>

authored by

Jing Yao and committed by
Pablo Neira Ayuso
c08d3286 c95c0783

+2 -2
+2 -2
net/netfilter/xt_IDLETIMER.c
··· 85 85 mutex_unlock(&list_mutex); 86 86 87 87 if (time_after(expires, jiffies) || ktimespec.tv_sec > 0) 88 - return snprintf(buf, PAGE_SIZE, "%ld\n", time_diff); 88 + return sysfs_emit(buf, "%ld\n", time_diff); 89 89 90 - return snprintf(buf, PAGE_SIZE, "0\n"); 90 + return sysfs_emit(buf, "0\n"); 91 91 } 92 92 93 93 static void idletimer_tg_work(struct work_struct *work)