[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260131122011.492961-2-thorsten.blum@linux.dev>
Date: Sat, 31 Jan 2026 13:20:11 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
James Clark <james.clark@...aro.org>,
Thomas Gleixner <tglx@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] perf/x86/intel: Replace snprintf with strscpy in intel_pmu_init
Replace snprintf("%s", ...) with the faster and more direct strscpy().
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
arch/x86/events/intel/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index bdf3f0d0fe21..025971ab6341 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <linux/export.h>
#include <linux/nmi.h>
#include <linux/kvm_host.h>
@@ -8077,7 +8078,7 @@ __init int intel_pmu_init(void)
}
}
- snprintf(pmu_name_str, sizeof(pmu_name_str), "%s", name);
+ strscpy(pmu_name_str, name);
if (!is_hybrid()) {
group_events_td.attrs = td_attr;
--
Thorsten Blum <thorsten.blum@...ux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Powered by blists - more mailing lists