[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220617041140.83705-1-jiapeng.chong@linux.alibaba.com>
Date:   Fri, 17 Jun 2022 12:11:40 +0800
From:   Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To:     peterz@...radead.org
Cc:     mingo@...hat.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
        namhyung@...nel.org, tglx@...utronix.de, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Subject: [PATCH] perf/x86/core: Replace snprintf() with sysfs_emit()
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 <jiapeng.chong@...ux.alibaba.com>
---
 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
Powered by blists - more mailing lists
 
