From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH net 09/11] netfilter: xt_IDLETIMER: replace snprintf in show functions with sysfs_emit
Date: Thu, 18 Nov 2021 23:26:16 +0100 [thread overview]
Message-ID: <20211118222618.433273-10-pablo@netfilter.org> (raw)
In-Reply-To: <20211118222618.433273-1-pablo@netfilter.org>
From: Jing Yao <yao.jing2@zte.com.cn>
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>
---
net/netfilter/xt_IDLETIMER.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
index 2f7cf5ecebf4..0f8bb0bf558f 100644
--- a/net/netfilter/xt_IDLETIMER.c
+++ b/net/netfilter/xt_IDLETIMER.c
@@ -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)
--
2.30.2
next prev parent reply other threads:[~2021-11-18 22:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 22:26 [PATCH net 00/11] Netfilter fixes for net Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 01/11] selftests: netfilter: add a vrf+conntrack testcase Pablo Neira Ayuso
2021-11-19 11:10 ` patchwork-bot+netdevbpf
2021-11-18 22:26 ` [PATCH net 02/11] selftests: netfilter: extend nfqueue tests to cover vrf device Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 03/11] netfilter: nft_payload: Remove duplicated include in nft_payload.c Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 04/11] selftests: nft_nat: Improve port shadow test stability Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 05/11] selftests: nft_nat: Simplify port shadow notrack test Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 06/11] netfilter: ctnetlink: fix filtering with CTA_TUPLE_REPLY Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 07/11] netfilter: ctnetlink: do not erase error code with EINVAL Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 08/11] netfilter: ipvs: Fix reuse connection if RS weight is 0 Pablo Neira Ayuso
2021-11-18 22:26 ` Pablo Neira Ayuso [this message]
2021-11-18 22:26 ` [PATCH net 10/11] netfilter: flowtable: fix IPv6 tunnel addr match Pablo Neira Ayuso
2021-11-18 22:26 ` [PATCH net 11/11] selftests: nft_nat: switch port shadow test cases to socat Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211118222618.433273-10-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).