All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/x86/core: Replace snprintf() with sysfs_emit()
@ 2022-06-17  4:11 Jiapeng Chong
  0 siblings, 0 replies; only message in thread
From: Jiapeng Chong @ 2022-06-17  4:11 UTC (permalink / raw)
  To: peterz
  Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
	tglx, bp, dave.hansen, x86, hpa, linux-perf-users, linux-kernel,
	Jiapeng Chong

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@linux.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-17  4:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  4:11 [PATCH] perf/x86/core: Replace snprintf() with sysfs_emit() Jiapeng Chong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.