Re: [PATCH v5 3/5] tracing: Use __free() for kprobe events to cleanup

From: Steven Rostedt
Date: Wed Jan 08 2025 - 10:08:21 EST


On Wed, 8 Jan 2025 11:11:07 +0900
"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
>
> Use __free() in trace_kprobe.c to cleanup code.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> ---
> Changes in v4:
> - Use no_free_ptr(tk)->tp instead of assiging NULL to tk.
> Changes in v3:
> - Rename to __free(free_trace_kprobe) to clarify what function will be called.
> - Add !IS_ERR_OR_NULL() check because alloc_trace_kprobe() returns an error code.
> - Prevent freeing 'tk' in create_local_trace_kprobe() when succeeded to register.
> Changes in v2:
> - Instead of using no_free_ptr(), just assign NULL to the registered pointer.
> ---
> kernel/trace/trace_kprobe.c | 62 ++++++++++++++++++++-----------------------
> 1 file changed, 29 insertions(+), 33 deletions(-)

Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve