* [PATCH] perf/x86/intel/uncore: Use sysfs_emit in uncore_event_show
@ 2026-02-06 19:42 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-02-06 19:42 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
Cc: Thorsten Blum, linux-perf-users, linux-kernel
Replace sprintf() with sysfs_emit() in uncore_event_show(). sysfs_emit()
is preferred to format sysfs output as it provides better bounds
checking.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
checkpatch warns about a missing terminating newline. Please let me know
if this should be added.
---
arch/x86/events/intel/uncore.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index e228e564b15e..532eb68d950b 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/module.h>
+#include <linux/sysfs.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
@@ -133,7 +134,7 @@ ssize_t uncore_event_show(struct device *dev,
{
struct uncore_event_desc *event =
container_of(attr, struct uncore_event_desc, attr);
- return sprintf(buf, "%s", event->config);
+ return sysfs_emit(buf, "%s", event->config);
}
struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-06 19:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 19:42 [PATCH] perf/x86/intel/uncore: Use sysfs_emit in uncore_event_show Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox