Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1571896pxb; Thu, 4 Nov 2021 04:54:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRJ+15VnEn5hWDTUcySNxNHEa7/mKVSVscoJJs2cl6ii4qtDin6GHaZ6qm0Wc+cuUmOmqy X-Received: by 2002:a50:cbc2:: with SMTP id l2mr40780827edi.89.1636026852268; Thu, 04 Nov 2021 04:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636026852; cv=none; d=google.com; s=arc-20160816; b=CuCVjwtYAsT7k15W5kT3IAXQeLKKfHm8/4QwWVhqXK/YbvRRE1Soe45MShqkNPnKXm FE3gdJpC6AXJ+byrhJY7ZHkroz+BQbFx4GgOatCluqLuST+avfyzz287Q2fpJD8He250 iEE2MALeo0yS3+aN3bV9dAfhGN1tmLmAsdcDVwyRBCGSXOqFeSflaWuOsQjNSLgZC/xo HnlBJYagMWMxJfHD25UiyJHpoqb0pRTOKj39g85EqHhSdKIYPBJ4BVdVHKYsN8pZWMIc CXn0sSHiNuhQo3tgpPrn6cH0wzrTV6QWj79Pz5gQ3cGTEh/ENKGk/JoViQCXJAnZFW7G TI4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KuPFje2AUfFzNhATj0vA/YQ0MyvJDY+bIV73xrs0RvI=; b=knKYz6hk6/3bpn/1d0pvRgnYHXgGABavvFvPU4GE8TYzL4WnL9FS1GTCLCWU75gZos z8Rhj7dRu5AwC9Pr32+nk8fK1GJnWfidryRMNp3uVMsm2jAspkHu4CLr/4LpO8gh3h7x r4iLd5axbLXIUXnUetbvjETrNLf6GWLlQY+i2NKcbKAuuzm3tyDyZuPwTriN6OaHyAd7 5TR9loQgZJD7XIFGI403J1b2I2P2JZVoH9YYChG4YgpaVYi47ejkO1jIkTJ6JzZPqpHU 8vXYiMK8hQuoa6scmTYkiDv7QtQ6+3g0kkcrJBik8tWRVlTyfCVFu2OEOsipisRTJo/4 Qalw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DQdZgG7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si10478526edb.525.2021.11.04.04.53.47; Thu, 04 Nov 2021 04:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DQdZgG7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbhKDLv6 (ORCPT + 99 others); Thu, 4 Nov 2021 07:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbhKDLv6 (ORCPT ); Thu, 4 Nov 2021 07:51:58 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6600FC061714; Thu, 4 Nov 2021 04:49:20 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id g13so3352313qtk.12; Thu, 04 Nov 2021 04:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KuPFje2AUfFzNhATj0vA/YQ0MyvJDY+bIV73xrs0RvI=; b=DQdZgG7ncr8s3KKVKwa3fXaIh48oz2vApeCPTJucPck1JOjSDVN7AIbtb+3uL9xUU+ dgDKRIDzuwYPdk5BL1T+3YnwRxfb9krTafY+lzn8rQ63YzNQrM9t3inidG4LS2xc0XaQ B9aVyDN1zY0iBjvMQcfjxJP2D/Iv371r55Ycv4h7bZ5vcyDGaFn9sayuxjcNiaqpQmEl ZBm1fFbW7oavXzpqqT4DW+Ym7WWpwNzEfesFf6vH1cEZUEGTWs9tWLdSTVBXn+g7EXOp uxuK396/sjqZ1LDYdMJ2UYExDPfC5Olgh1SKcCTMsCrF8B9YWc1/lzDpsqbNwszJJ4wG D/cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KuPFje2AUfFzNhATj0vA/YQ0MyvJDY+bIV73xrs0RvI=; b=iPCAwOvII45UPsOdED6iv303mae1k8gsKuy08euTLWAjwodfOmwMTIyDW5vdLziMF8 tzu5R1nVKAN2ogGN8nSUEFQ0JzZebr+ZaYvgBqMwhjnxxkstU5gJ1MSzCPd7u8iK1vK9 HtkmVkZcmFPAnu7/7H/El5l04230vm7Xem5ybuok01ifgNCXvKEZ4yjT94fJXeE+dTrQ cLAsGQ+Dzs4PvTcc0kpfRLT7Hygj0xvVBzGSG9nx58Xjz5cV9jMfnkCoKPgvCKQEd40Z Vg3IdHybpgLuikAmanV9VxjGPvHZz3Y4bKeTmmv4eavvqYsvy7nrAm2tytkQjics6ADy EAMg== X-Gm-Message-State: AOAM532DPaXrEteE7X9oZPpNSiEB39Ck/loeiPe42hA5YS76ngqHCkAE iHf8mnv0JpqCy+BV3TOVi3w= X-Received: by 2002:ac8:610b:: with SMTP id a11mr51988133qtm.182.1636026559643; Thu, 04 Nov 2021 04:49:19 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id g8sm3314601qka.45.2021.11.04.04.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 04:49:19 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: yao.jing2@zte.com.cn To: pablo@netfilter.org Cc: kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net, kuba@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jing Yao , Zeal Robot Subject: [PATCH] netfilter: xt_IDLETIMER: replace snprintf in show functions with sysfs_emit Date: Thu, 4 Nov 2021 11:49:11 +0000 Message-Id: <20211104114911.31214-1-yao.jing2@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jing Yao 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 Signed-off-by: Jing Yao --- 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.25.1