On Mon, 25 May 2026 23:55:07 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:

> On Thu, 21 May 2026 22:50:33 -0400
> Steven Rostedt <[email protected]> wrote:
> 
> > +static int handle_typecast(char *arg, struct fetch_insn **pcode,
> > +                      struct fetch_insn *end,
> > +                      struct traceprobe_parse_context *ctx)
> > +{
> > +   char *tmp;
> > +   int ret;
> > +
> > +   /* Currently this only works for eprobes */
> > +   if (!(ctx->flags & TPARG_FL_TEVENT)) {
> > +           trace_probe_log_err(ctx->offset, TYPECAST_NOT_EVENT);
> > +           return -EINVAL;
> > +   }
> > +
> > +   tmp = strchr(arg, ')');
> > +   if (!tmp) {
> > +           trace_probe_log_err(ctx->offset + strlen(arg),
> > +                               DEREF_OPEN_BRACE);
> > +           return -EINVAL;
> > +   }
> > +   *tmp = '\0';
> > +   ret = query_btf_struct(arg + 1, ctx);
> > +   *tmp = ')';  
> 
> BTW, is there any reason to recover this? The @arg is copied
> string, see traceprobe_parse_probe_arg_body().

Yeah I know. But it's just something I prefer to do to keep code more
robust. That is, don't leave side effects if you can help it. It likely
doesn't matter here, but I've always errored on the side of caution. ;-)

-- Steve


Reply via email to