All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: probes: remove unused variable
@ 2026-05-02 13:57 Martin Kaiser
  2026-05-04  8:59 ` Markus Schneider-Pargmann
  2026-10-13  9:17 ` Masami Hiramatsu
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Kaiser @ 2026-05-02 13:57 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu
  Cc: Markus Schneider-Pargmann, linux-trace-kernel, linux-kernel,
	Martin Kaiser

params is always NULL in traceprobe_expand_meta_args, it can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
Would it be better to return ERR_PTR(-EOPNOTSUPP) instead of NULL, similar to
what is done in other places where NOSUP_BTFARG is logged? This would make the
parsing fail if $arg* is used without BTF support. At the moment, we skip the
$arg*...

 kernel/trace/trace_probe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index e0d3a0da26af..b627093a941e 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1729,7 +1729,6 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 					 int *new_argc, char *buf, int bufsize,
 					 struct traceprobe_parse_context *ctx)
 {
-	const struct btf_param *params = NULL;
 	int i, j, n, used, ret, args_idx = -1;
 	const char **new_argv __free(kfree) = NULL;
 
@@ -1747,7 +1746,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 		if (args_idx != -1) {
 			/* $arg* requires BTF info */
 			trace_probe_log_err(0, NOSUP_BTFARG);
-			return (const char **)params;
+			return NULL;
 		}
 		*new_argc = argc;
 		return NULL;
-- 
2.43.7


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

* Re: [PATCH] tracing: probes: remove unused variable
  2026-05-02 13:57 [PATCH] tracing: probes: remove unused variable Martin Kaiser
@ 2026-05-04  8:59 ` Markus Schneider-Pargmann
  2026-10-13  9:17 ` Masami Hiramatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Schneider-Pargmann @ 2026-05-04  8:59 UTC (permalink / raw)
  To: Martin Kaiser, Steven Rostedt, Masami Hiramatsu
  Cc: Markus Schneider-Pargmann, linux-trace-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

On Sat May 2, 2026 at 3:57 PM CEST, Martin Kaiser wrote:
> params is always NULL in traceprobe_expand_meta_args, it can be removed.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>

Reviewed-by: Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>

Best
Markus

> ---
> Would it be better to return ERR_PTR(-EOPNOTSUPP) instead of NULL, similar to
> what is done in other places where NOSUP_BTFARG is logged? This would make the
> parsing fail if $arg* is used without BTF support. At the moment, we skip the
> $arg*...
>
>  kernel/trace/trace_probe.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index e0d3a0da26af..b627093a941e 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -1729,7 +1729,6 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
>  					 int *new_argc, char *buf, int bufsize,
>  					 struct traceprobe_parse_context *ctx)
>  {
> -	const struct btf_param *params = NULL;
>  	int i, j, n, used, ret, args_idx = -1;
>  	const char **new_argv __free(kfree) = NULL;
>  
> @@ -1747,7 +1746,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
>  		if (args_idx != -1) {
>  			/* $arg* requires BTF info */
>  			trace_probe_log_err(0, NOSUP_BTFARG);
> -			return (const char **)params;
> +			return NULL;
>  		}
>  		*new_argc = argc;
>  		return NULL;


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]

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

* Re: [PATCH] tracing: probes: remove unused variable
  2026-05-02 13:57 [PATCH] tracing: probes: remove unused variable Martin Kaiser
  2026-05-04  8:59 ` Markus Schneider-Pargmann
@ 2026-10-13  9:17 ` Masami Hiramatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2026-10-13  9:17 UTC (permalink / raw)
  To: martin
  Cc: Steven Rostedt, Masami Hiramatsu, Markus Schneider-Pargmann,
	linux-trace-kernel, linux-kernel, Martin Kaiser

Hi,

On Sat, 02 May 2026 15:57:42 +0200, Martin Kaiser <martin@kaiser.cx> wrote:
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -1747,7 +1746,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
>  		if (args_idx != -1) {
>  			/* $arg* requires BTF info */
>  			trace_probe_log_err(0, NOSUP_BTFARG);
> +			return NULL;

Returning NULL here causes traceprobe_expand_meta_args() to treat this as
success (no expansion needed), leaving *new_argc uninitialized and passing
the unexpanded "$arg*" to subsequent argument parsing (which later fails
with a confusing error).

We should return an error here rather than NULL.

Specifically, returning ERR_PTR(-EOPNOTSUPP) is the right fix, which also
eliminates the need for the params variable.

This is a bug, introduced by commit d157d7694460 ("tracing/probes: Support
BTF field access from $retval").

Can you update to fix this bug?

Thank you,

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

end of thread, other threads:[~2026-10-13  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02 13:57 [PATCH] tracing: probes: remove unused variable Martin Kaiser
2026-05-04  8:59 ` Markus Schneider-Pargmann
2026-10-13  9:17 ` Masami Hiramatsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.