Re: [PATCH v5] tracing/eprobes: Allow use of BTF names to dereference pointers

From: Google

Date: Wed May 20 2026 - 21:58:42 EST


On Wed, 20 May 2026 12:48:32 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Wed, 20 May 2026 15:20:21 +0900
> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
>
> > > > > @@ -515,6 +542,10 @@ static void clear_btf_context(struct traceprobe_parse_context *ctx)
> > > > > ctx->params = NULL;
> > > > > ctx->nr_params = 0;
> > > > > }
> > > > > + if (ctx->struct_btf) {
> > > > > + btf_put(ctx->struct_btf);
> > > > > + ctx->last_struct = NULL;
> > > >
> > > > [Severity: Low]
> > > > Should ctx->struct_btf be explicitly set to NULL after btf_put() drops
> > > > the reference?
> > >
> > > I'm thinking of dropping it in the '(' switch case.
> >
> > Can you consider making the '(' switch case part as a helper
> > function because it depends on CONFIG_DEBUG_INFO_BTF?
>
> Should we just encapsulate that entire case statement with:
>
> #ifdef CONFIG_DEBUG_INFO_BTF
> [..]
> #endif

Yeah that is possible, and I rather like to make it a separate
function for simplifying switch-case block for readability.

Thank you,

>
> ?
>
> -- Steve
>
>


--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>