From patchwork Sat May 9 08:35:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenzhou X-Patchwork-Id: 11538037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FB1581 for ; Sat, 9 May 2020 08:32:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A1592192A for ; Sat, 9 May 2020 08:32:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t22mKmqG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A1592192A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ETgMtW3E7PMD/ZDCt+X868iJp3y0x2+MC9wZnmK39vQ=; b=t22mKmqGbcHkUQ WAP6+kRNiJdr7qPdwITX5ROTuq3EbZPkM7FVHBKVKEyMmBPxGaRnexaYPysl2N3oGAsmZiI/vbe1M 3LI38MrWklMd7uFwQCQLnWtgVHaNZm08CeIAOU0FUmMX087RonI2omrPMasifRzTyo6R/gEioNWBO sib0LGDs+MQKVIeRD4ubZdd8NhP81WmB+sPsaTAaYU24RRbdGvohn7hTsl+9rW49o3XbcpTL1LXvm bc/tV4fUMHUqPQZgPKFaf8aQYyUeP0kEzW+oIHmSy64GW0YpUwEVQjXSgJ7GPbyJL8B7c30yHDWKQ Fh6DEAxG7CYkRDSi2Baw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXKuK-0006Rn-UT; Sat, 09 May 2020 08:32:29 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXKuB-0006CO-BS for linux-arm-kernel@lists.infradead.org; Sat, 09 May 2020 08:32:21 +0000 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A473988AA014325E9833; Sat, 9 May 2020 16:31:57 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 16:31:48 +0800 From: Chen Zhou To: , Subject: [PATCH -next] arch/arm: use scnprintf() in l2x0_pmu_event_show() Date: Sat, 9 May 2020 16:35:39 +0800 Message-ID: <20200509083539.113156-1-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200509_013219_568923_11F6B8ED X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.32 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [45.249.212.32 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chenzhou10@huawei.com, linux-kernel@vger.kernel.org, alexios.zavras@intel.com, allison@lohutok.net, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org snprintf() returns the number of bytes that would be written, which may be greater than the the actual length to be written. show() methods should return the number of bytes printed into the buffer. This is the return value of scnprintf(). Signed-off-by: Chen Zhou --- arch/arm/mm/cache-l2x0-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/cache-l2x0-pmu.c b/arch/arm/mm/cache-l2x0-pmu.c index 993fefdc167a..d20626451a2e 100644 --- a/arch/arm/mm/cache-l2x0-pmu.c +++ b/arch/arm/mm/cache-l2x0-pmu.c @@ -343,7 +343,7 @@ static ssize_t l2x0_pmu_event_show(struct device *dev, struct l2x0_event_attribute *lattr; lattr = container_of(attr, typeof(*lattr), attr); - return snprintf(buf, PAGE_SIZE, "config=0x%x\n", lattr->config); + return scnprintf(buf, PAGE_SIZE, "config=0x%x\n", lattr->config); } static umode_t l2x0_pmu_event_attr_is_visible(struct kobject *kobj,