[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250109104331.5a11a889c4d07b9ebddcadd3@kernel.org>
Date: Thu, 9 Jan 2025 10:43:31 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Anil S Keshavamurthy
<anil.s.keshavamurthy@...el.com>, "David S . Miller" <davem@...emloft.net>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Oleg Nesterov
<oleg@...hat.com>, Tzvetomir Stoyanov <tz.stoyanov@...il.com>, Naveen N Rao
<naveen@...nel.org>, Josh Poimboeuf <jpoimboe@...nel.org>, Jason Baron
<jbaron@...mai.com>, Ard Biesheuvel <ardb@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v5 5/5] tracing: Adopt __free() and guard() for
trace_fprobe.c
On Wed, 8 Jan 2025 10:07:36 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Wed, 8 Jan 2025 11:11:30 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
>
> > @@ -1234,24 +1223,26 @@ static int __trace_fprobe_create(int argc, const char *argv[])
> > trace_probe_log_err(0, BAD_PROBE_ADDR);
> > else if (ret != -ENOMEM && ret != -EEXIST)
> > trace_probe_log_err(0, FAIL_REG_PROBE);
> > - goto error;
> > - }
> > + ret = -EINVAL;
> > + } else
> > + /* 'tf' is successfully registered. To avoid freeing, assign NULL. */
> > + tf = NULL;
> >
> > -out:
> > - if (tp_mod)
> > - module_put(tp_mod);
> > + return ret;
> > +}
> > +
>
> Hmm, the above could probably be simplified as:
>
> ret = register_trace_fprobe(tf);
> if (ret) {
> trace_probe_log_set_index(1);
> if (ret == -EILSEQ)
> trace_probe_log_err(0, BAD_INSN_BNDRY);
> else if (ret == -ENOENT)
> trace_probe_log_err(0, BAD_PROBE_ADDR);
> else if (ret != -ENOMEM && ret != -EEXIST)
> trace_probe_log_err(0, FAIL_REG_PROBE);
> return -EINVAL;
> }
>
> /* 'tf' is successfully registered. To avoid freeing, assign NULL. */
> tf = NULL;
>
> return 0;
Indeed. Thanks!
> }
>
> -- Steve
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists