Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp55794iog; Thu, 16 Jun 2022 21:39:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sIqXjiGEe5BCdka4pP18Mix1mij3OuQN6LjPcdauKqzMZE05dtTNbm/FiWqlCnwMJK7soA X-Received: by 2002:a63:4a23:0:b0:3fd:f7e9:4c92 with SMTP id x35-20020a634a23000000b003fdf7e94c92mr7494875pga.568.1655440782731; Thu, 16 Jun 2022 21:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655440782; cv=none; d=google.com; s=arc-20160816; b=N0D/DqCxqEjjGw2U3hDW2sfs2GkMPRne6Y3eNpQgUhIjEI4fOFaeZsJMGWmL30bWGm 1AkEAUZ9vjMqckMMCuAkAuWtupjA1HGfZRLpdu9X2iv+9STPCQZrkWBLUbIh3R/Wsggt 1PBTK5Vyjfp0xNm1ziokmL6wrhMe+FD5bh/ktWaS4PpFto1UnBiiLscADh0m1hr8FvLa Ju1gWhWOpTxLWhTKAWhQnFc0nDJ/JWFr9F7QT8pKLuqpQrr/EcdIBdHc/Xz/dxOJMse9 BSBGioqW8yyYmSsLo8vlsn6DyVP+lQcw/MTDqPsDAuWgM4hJ9mp8njc38zFqiZABKCQx kQ8Q== 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; bh=t+Po8aofU3IuRG+z0MAdd/JnncskIHEKkqdhwvVjFVs=; b=HoN/GG+ONp0eqe0Rdc/IzUzEfjYn0zJGIF0CxakMsS3CpSSj13GDuLqf9IAF3Eyc8i TV0ip+RVZ3wVi1yL25ZD3g8Le9nN+P54K5HNA8RxzH3WzLoPRxW/v3Ac4wej7BNZu3x+ kCByoVZA8rdHkkfjSUpwLt6taxVBgEO3fG7AvcP09QWsLdxeDgy6PKvWgKecvtGqtKQZ U5fqttaV7ar2lpwNkIcD0OZHQRts8OolHeVLaWzv9zRaNaZompDUHfSEN1E0RyzO0s/C dr5SFwfncUsHxvNivAjZCghdC0VDnqoNRRgpAyZ7vs7TeQEm30OJIbj1zHQg0CDnv7xM 6G+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y73-20020a638a4c000000b003fc64b118b9si4486817pgd.450.2022.06.16.21.39.30; Thu, 16 Jun 2022 21:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379857AbiFQEMZ (ORCPT + 99 others); Fri, 17 Jun 2022 00:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbiFQEMY (ORCPT ); Fri, 17 Jun 2022 00:12:24 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A6C765D25; Thu, 16 Jun 2022 21:12:21 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R961e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VGd7QNO_1655439102; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VGd7QNO_1655439102) by smtp.aliyun-inc.com; Fri, 17 Jun 2022 12:12:18 +0800 From: Jiapeng Chong To: peterz@infradead.org Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] perf/x86/core: Replace snprintf() with sysfs_emit() Date: Fri, 17 Jun 2022 12:11:40 +0800 Message-Id: <20220617041140.83705-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org coccicheck complains about the use of snprintf() in sysfs show functions. ./arch/x86/events/core.c:2627:8-16: WARNING: use scnprintf or sprintf. Signed-off-by: Jiapeng Chong --- arch/x86/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index f969410d0c90..7a1a42768122 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2624,7 +2624,7 @@ static ssize_t max_precise_show(struct device *cdev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu_max_precise()); + return sysfs_emit(buf, "%d\n", x86_pmu_max_precise()); } static DEVICE_ATTR_RO(max_precise); -- 2.20.1.7.g153144c