* [PATCH] perf/x86/intel: Replace snprintf with strscpy in intel_pmu_init
@ 2026-01-31 12:20 Thorsten Blum
2026-09-15 21:53 ` Ian Rogers
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-01-31 12:20 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 snprintf("%s", ...) with the faster and more direct strscpy().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.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@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] perf/x86/intel: Replace snprintf with strscpy in intel_pmu_init
2026-01-31 12:20 [PATCH] perf/x86/intel: Replace snprintf with strscpy in intel_pmu_init Thorsten Blum
@ 2026-09-15 21:53 ` Ian Rogers
0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2026-09-15 21:53 UTC (permalink / raw)
To: Thorsten Blum, Peter Zijlstra, Ingo Molnar, Dapeng Mi
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, linux-perf-users, linux-kernel
On Sat, Jan 31, 2026 at 4:21 AM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Replace snprintf("%s", ...) with the faster and more direct strscpy().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> 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@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-31 12:20 [PATCH] perf/x86/intel: Replace snprintf with strscpy in intel_pmu_init Thorsten Blum
2026-09-15 21:53 ` Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®