linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] perf trace: Fix filter expansion length typo
@ 2025-10-28  4:00 Zoe Gates
  2025-10-28 15:01 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Zoe Gates @ 2025-10-28  4:00 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung
  Cc: mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter,
	zoe, yujie.liu, sandipan.das, leo.yan, linux-perf-users,
	linux-kernel

From 08185c5be135eb83194a49e593be9258cec78d77 Mon Sep 17 00:00:00 2001
From: Zoe Gates <zoe@zeocities.dev>
Date: Mon, 27 Oct 2025 22:14:24 -0500
Subject: [PATCH 1/3] perf trace: Fix filter expansion length typo

Keep the filter expansion helper readable by using
expansion_length everywhere and wrapping the scnprintf call.

Signed-off-by: Zoe Gates <zoe@zeocities.dev>
---
 tools/perf/Documentation/perf-script.txt | 2 +-
 tools/perf/builtin-trace.c               | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-script.txt
b/tools/perf/Documentation/perf-script.txt
index 28bec7e78bc8..e136ca35d380 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -262,7 +262,7 @@ OPTIONS
 	is printed. This is the full execution path leading to the
sample. This is only supported when the
 	sample was recorded with perf record -b or -j any.
 
-	Use brstackinsnlen to print the brstackinsn lenght. For
example, you
+	Use brstackinsnlen to print the brstackinsn length. For
example, you
 	can’t know the next sequential instruction after an
unconditional branch unless
 	you calculate that based on its length.
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index c607f39b8c8b..ae5fabf91c96 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4291,7 +4291,10 @@ static int trace__expand_filter(struct trace
*trace, struct evsel *evsel)
 
 				if (fmt->strtoul(right, right_size,
&syscall_arg, &val)) {
 					char *n, expansion[19];
-					int expansion_lenght =
scnprintf(expansion, sizeof(expansion), "%#" PRIx64, val);
+					int expansion_length;
+
+					expansion_length =
scnprintf(expansion, sizeof(expansion),
+								    
"%#" PRIx64, val);
 					int expansion_offset = right -
new_filter;
 
 					pr_debug("%s", expansion);
@@ -4303,7 +4306,7 @@ static int trace__expand_filter(struct trace
*trace, struct evsel *evsel)
 					}
 					if (new_filter != evsel-
>filter)
 						free(new_filter);
-					left = n + expansion_offset +
expansion_lenght;
+					left = n + expansion_offset +
expansion_length;
 					new_filter = n;
 				} else {
 					pr_err("\"%.*s\" not found for
\"%s\" in \"%s\", can't set filter \"%s\"\n",

base-commit: fd57572253bc356330dbe5b233c2e1d8426c66fd
-- 
2.51.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] perf trace: Fix filter expansion length typo
  2025-10-28  4:00 [PATCH 1/3] perf trace: Fix filter expansion length typo Zoe Gates
@ 2025-10-28 15:01 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-10-28 15:01 UTC (permalink / raw)
  To: Zoe Gates
  Cc: peterz, mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, zoe, yujie.liu, sandipan.das, leo.yan,
	linux-perf-users, linux-kernel

On Mon, Oct 27, 2025 at 11:00:33PM -0500, Zoe Gates wrote:
> >From 08185c5be135eb83194a49e593be9258cec78d77 Mon Sep 17 00:00:00 2001
> From: Zoe Gates <zoe@zeocities.dev>
> Date: Mon, 27 Oct 2025 22:14:24 -0500
> Subject: [PATCH 1/3] perf trace: Fix filter expansion length typo
> 
> Keep the filter expansion helper readable by using
> expansion_length everywhere and wrapping the scnprintf call.

You're mixing up changes to the perf-script man page with the perf trace
source code and the patch is garbled:

⬢ [acme@toolbx perf-tools]$        patch -p1 < ./20251027_zoe_blair_gates_perf_trace_fix_filter_expansion_length_typo.mbx
patching file tools/perf/Documentation/perf-script.txt
patch: **** malformed patch at line 42: sample. This is only supported when the

⬢ [acme@toolbx perf-tools]$

also plese try to keep the
existing code structure when changing just typos, i.e. if you have:

	int variable = function();

Don't change it to:

	int variable;

	variable = function();

- Arnaldo
 
> Signed-off-by: Zoe Gates <zoe@zeocities.dev>
> ---
>  tools/perf/Documentation/perf-script.txt | 2 +-
>  tools/perf/builtin-trace.c               | 7 +++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/Documentation/perf-script.txt
> b/tools/perf/Documentation/perf-script.txt
> index 28bec7e78bc8..e136ca35d380 100644
> --- a/tools/perf/Documentation/perf-script.txt
> +++ b/tools/perf/Documentation/perf-script.txt
> @@ -262,7 +262,7 @@ OPTIONS
>  	is printed. This is the full execution path leading to the
> sample. This is only supported when the
>  	sample was recorded with perf record -b or -j any.
>  
> -	Use brstackinsnlen to print the brstackinsn lenght. For
> example, you
> +	Use brstackinsnlen to print the brstackinsn length. For
> example, you
>  	can’t know the next sequential instruction after an
> unconditional branch unless
>  	you calculate that based on its length.
>  
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index c607f39b8c8b..ae5fabf91c96 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -4291,7 +4291,10 @@ static int trace__expand_filter(struct trace
> *trace, struct evsel *evsel)
>  
>  				if (fmt->strtoul(right, right_size,
> &syscall_arg, &val)) {
>  					char *n, expansion[19];
> -					int expansion_lenght =
> scnprintf(expansion, sizeof(expansion), "%#" PRIx64, val);
> +					int expansion_length;
> +
> +					expansion_length =
> scnprintf(expansion, sizeof(expansion),
> +								    
> "%#" PRIx64, val);
>  					int expansion_offset = right -
> new_filter;
>  
>  					pr_debug("%s", expansion);
> @@ -4303,7 +4306,7 @@ static int trace__expand_filter(struct trace
> *trace, struct evsel *evsel)
>  					}
>  					if (new_filter != evsel-
> >filter)
>  						free(new_filter);
> -					left = n + expansion_offset +
> expansion_lenght;
> +					left = n + expansion_offset +
> expansion_length;
>  					new_filter = n;
>  				} else {
>  					pr_err("\"%.*s\" not found for
> \"%s\" in \"%s\", can't set filter \"%s\"\n",
> 
> base-commit: fd57572253bc356330dbe5b233c2e1d8426c66fd
> -- 
> 2.51.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-28 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28  4:00 [PATCH 1/3] perf trace: Fix filter expansion length typo Zoe Gates
2025-10-28 15:01 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).