perf/x86/intel/uncore: Use sysfs_emit() in uncore_event_show()
Subsystems (2)
PATCH RESEND v2 1/1 perf/x86/intel/uncore: Use sysfs_emit() in uncore_event_show()
Replace sprintf() with sysfs_emit() in uncore_event_show(). sysfs_emit() is preferred for formatting sysfs output because it provides safer bounds checking.
Add a terminating newline as suggested by checkpatch.
---
Changes in v2:
- Add a terminating newline as suggested by checkpatch
- v1: https://lore.kernel.org/r/[email protected]/
arch/x86/events/intel/uncore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore.c +2 -1
@@ -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>
@@ -153,7 +154,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\n" , event->config); }struct intel_uncore_box *uncore_pmu_to_box (struct intel_uncore_pmu *pmu,int cpu)
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 10 lines
Replace
sprintf()withsysfs_emit()inuncore_event_show().sysfs_emit()is preferred for formatting sysfs output because it provides safer bounds checking.Add a terminating newline as suggested by checkpatch.
Acked-by Namhyung Kim <[email protected]>Reviewed-by Dapeng Mi <[email protected]>Reviewed-by Ian Rogers <[email protected]>Signed-off-by Thorsten Blum <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: f16e34ff09cc4e976a303e54e9290022ac5d2db4 Gitweb: https://git.kernel.org/tip/f16e34ff09cc4e976a303e54e9290022ac5d2db4 Author: Thorsten Blum <[email protected]> AuthorDate: Wed, 11 Nov 2026 17:49:27 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 18 Nov 2026 14:32:22 +01:00
perf/x86/intel/uncore: Use sysfs_emit() in uncore_event_show()
Replace sprintf() with sysfs_emit() in uncore_event_show(). sysfs_emit() is preferred for formatting sysfs output because it provides safer bounds checking.
Add a terminating newline as suggested by checkpatch.
--- arch/x86/events/intel/uncore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore.c +2 -1
@@ -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>
@@ -153,7 +154,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\n" , event->config); }struct intel_uncore_box *uncore_pmu_to_box (struct intel_uncore_pmu *pmu,int cpu)