Linux Trace Kernel
 help / color / mirror / Atom feed
From: Yu Peng <pengyu@kylinos.cn>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] tracing/synthetic: Free type string on error path
Date: Tue, 7 Jul 2026 21:22:24 +0800	[thread overview]
Message-ID: <852e911a-d18b-455c-a1cf-720f224349cd@kylinos.cn> (raw)
In-Reply-To: <20260706131534.70e602ef@gandalf.local.home>

On 7/7/2026 1:15 AM, Steven Rostedt wrote:

> Can you do this instead?
> 
> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
> index cdd5b9332835..7ff0f00edbdd 100644
> --- a/kernel/trace/trace_events_synth.c
> +++ b/kernel/trace/trace_events_synth.c
> @@ -828,7 +828,7 @@ static struct synth_field *parse_synth_field(int argc, char **argv,
>   	} else if (size == 0) {
>   		if (synth_field_is_string(field->type) ||
>   		    synth_field_is_stack(field->type)) {
> -			char *type;
> +			char *type __free(kfree) = NULL;
>   
>   			len = sizeof("__data_loc ") + strlen(field->type) + 1;
>   			type = kzalloc(len, GFP_KERNEL);
> @@ -844,7 +844,7 @@ static struct synth_field *parse_synth_field(int argc, char **argv,
>   			s.buffer[s.len] = '\0';
>   
>   			kfree(field->type);
> -			field->type = type;
> +			field->type = no_free_ptr(type);
>   
>   			field->is_dynamic = true;
>   			size = sizeof(u64);
> 
> -- Steve

Yes, that looks better. I'll fold it into v2.

Thanks,
Yu Peng

      reply	other threads:[~2026-07-07 13:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  6:25 [PATCH 1/2] tracing/synthetic: Free pending field on error path Yu Peng
2026-06-03  6:25 ` [PATCH 2/2] tracing/synthetic: Free type string " Yu Peng
2026-07-06 17:15   ` Steven Rostedt
2026-07-07 13:22     ` Yu Peng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=852e911a-d18b-455c-a1cf-720f224349cd@kylinos.cn \
    --to=pengyu@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox