Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] tracing/probes: ignore id update from btf_type_skip_modifiers
@ 2026-06-23 13:29 Martin Kaiser
  2026-06-24  0:24 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kaiser @ 2026-06-23 13:29 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu
  Cc: linux-trace-kernel, linux-kernel, Martin Kaiser

We can pass NULL as id pointer to btf_type_skip_modifiers if we do not
need the id of the returned btf_type.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 kernel/trace/trace_probe.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 9b3219e755cb..78bca283763f 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -360,9 +360,8 @@ static bool btf_type_is_char_ptr(struct btf *btf, const struct btf_type *type)
 {
 	const struct btf_type *real_type;
 	u32 intdata;
-	s32 tid;
 
-	real_type = btf_type_skip_modifiers(btf, type->type, &tid);
+	real_type = btf_type_skip_modifiers(btf, type->type, NULL);
 	if (!real_type)
 		return false;
 
@@ -379,14 +378,13 @@ static bool btf_type_is_char_array(struct btf *btf, const struct btf_type *type)
 	const struct btf_type *real_type;
 	const struct btf_array *array;
 	u32 intdata;
-	s32 tid;
 
 	if (BTF_INFO_KIND(type->info) != BTF_KIND_ARRAY)
 		return false;
 
 	array = (const struct btf_array *)(type + 1);
 
-	real_type = btf_type_skip_modifiers(btf, array->type, &tid);
+	real_type = btf_type_skip_modifiers(btf, array->type, NULL);
 
 	intdata = btf_type_int(real_type);
 	return !(BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED)
@@ -589,7 +587,6 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
 	struct btf *btf = ctx_btf(ctx);
 	char *next;
 	int is_ptr;
-	s32 tid;
 
 	do {
 		if (!is_struct) {
@@ -600,7 +597,7 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
 			}
 
 			/* Convert a struct pointer type to a struct type */
-			type = btf_type_skip_modifiers(btf, type->type, &tid);
+			type = btf_type_skip_modifiers(btf, type->type, NULL);
 			if (!type) {
 				trace_probe_log_err(ctx->offset, BAD_BTF_TID);
 				return -EINVAL;
@@ -640,7 +637,7 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
 				ctx->last_bitsize = 0;
 			}
 
-			type = btf_type_skip_modifiers(btf, field->type, &tid);
+			type = btf_type_skip_modifiers(btf, field->type, NULL);
 			if (!type) {
 				trace_probe_log_err(ctx->offset, BAD_BTF_TID);
 				return -EINVAL;
@@ -759,7 +756,7 @@ static int parse_btf_arg(char *varname,
 	return -ENOENT;
 
 found:
-	type = btf_type_skip_modifiers(ctx->btf, tid, &tid);
+	type = btf_type_skip_modifiers(ctx->btf, tid, NULL);
 found_type:
 	if (!type) {
 		trace_probe_log_err(ctx->offset, BAD_BTF_TID);
-- 
2.43.7


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

* Re: [PATCH] tracing/probes: ignore id update from btf_type_skip_modifiers
  2026-06-23 13:29 [PATCH] tracing/probes: ignore id update from btf_type_skip_modifiers Martin Kaiser
@ 2026-06-24  0:24 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2026-06-24  0:24 UTC (permalink / raw)
  To: Martin Kaiser; +Cc: Steven Rostedt, linux-trace-kernel, linux-kernel

On Tue, 23 Jun 2026 15:29:32 +0200
Martin Kaiser <martin@kaiser.cx> wrote:

> We can pass NULL as id pointer to btf_type_skip_modifiers if we do not
> need the id of the returned btf_type.
> 

Good catch! Let me pick it to probes/core.

Thanks,

> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  kernel/trace/trace_probe.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index 9b3219e755cb..78bca283763f 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -360,9 +360,8 @@ static bool btf_type_is_char_ptr(struct btf *btf, const struct btf_type *type)
>  {
>  	const struct btf_type *real_type;
>  	u32 intdata;
> -	s32 tid;
>  
> -	real_type = btf_type_skip_modifiers(btf, type->type, &tid);
> +	real_type = btf_type_skip_modifiers(btf, type->type, NULL);
>  	if (!real_type)
>  		return false;
>  
> @@ -379,14 +378,13 @@ static bool btf_type_is_char_array(struct btf *btf, const struct btf_type *type)
>  	const struct btf_type *real_type;
>  	const struct btf_array *array;
>  	u32 intdata;
> -	s32 tid;
>  
>  	if (BTF_INFO_KIND(type->info) != BTF_KIND_ARRAY)
>  		return false;
>  
>  	array = (const struct btf_array *)(type + 1);
>  
> -	real_type = btf_type_skip_modifiers(btf, array->type, &tid);
> +	real_type = btf_type_skip_modifiers(btf, array->type, NULL);
>  
>  	intdata = btf_type_int(real_type);
>  	return !(BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED)
> @@ -589,7 +587,6 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
>  	struct btf *btf = ctx_btf(ctx);
>  	char *next;
>  	int is_ptr;
> -	s32 tid;
>  
>  	do {
>  		if (!is_struct) {
> @@ -600,7 +597,7 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
>  			}
>  
>  			/* Convert a struct pointer type to a struct type */
> -			type = btf_type_skip_modifiers(btf, type->type, &tid);
> +			type = btf_type_skip_modifiers(btf, type->type, NULL);
>  			if (!type) {
>  				trace_probe_log_err(ctx->offset, BAD_BTF_TID);
>  				return -EINVAL;
> @@ -640,7 +637,7 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
>  				ctx->last_bitsize = 0;
>  			}
>  
> -			type = btf_type_skip_modifiers(btf, field->type, &tid);
> +			type = btf_type_skip_modifiers(btf, field->type, NULL);
>  			if (!type) {
>  				trace_probe_log_err(ctx->offset, BAD_BTF_TID);
>  				return -EINVAL;
> @@ -759,7 +756,7 @@ static int parse_btf_arg(char *varname,
>  	return -ENOENT;
>  
>  found:
> -	type = btf_type_skip_modifiers(ctx->btf, tid, &tid);
> +	type = btf_type_skip_modifiers(ctx->btf, tid, NULL);
>  found_type:
>  	if (!type) {
>  		trace_probe_log_err(ctx->offset, BAD_BTF_TID);
> -- 
> 2.43.7
> 


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

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

end of thread, other threads:[~2026-06-24  0:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 13:29 [PATCH] tracing/probes: ignore id update from btf_type_skip_modifiers Martin Kaiser
2026-06-24  0:24 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox