From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
"David S . Miller" <davem@davemloft.net>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Oleg Nesterov <oleg@redhat.com>,
Tzvetomir Stoyanov <tz.stoyanov@gmail.com>,
Naveen N Rao <naveen@kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jason Baron <jbaron@akamai.com>, Ard Biesheuvel <ardb@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v5 5/5] tracing: Adopt __free() and guard() for trace_fprobe.c
Date: Thu, 9 Jan 2025 10:43:31 +0900 [thread overview]
Message-ID: <20250109104331.5a11a889c4d07b9ebddcadd3@kernel.org> (raw)
In-Reply-To: <20250108100736.7f08d054@gandalf.local.home>
On Wed, 8 Jan 2025 10:07:36 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 8 Jan 2025 11:11:30 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.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@kernel.org>
prev parent reply other threads:[~2025-01-09 1:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 2:10 [PATCH v5 0/5] tracing/probes: Cleanup with guard and __free for kprobe and fprobe Masami Hiramatsu (Google)
2025-01-08 2:10 ` [PATCH v5 1/5] tracing/kprobes: Fix to free objects when failed to copy a symbol Masami Hiramatsu (Google)
2025-01-08 15:08 ` Steven Rostedt
2025-01-08 2:10 ` [PATCH v5 2/5] tracing: Use __free() in trace_probe for cleanup Masami Hiramatsu (Google)
2025-01-08 15:08 ` Steven Rostedt
2025-01-08 2:11 ` [PATCH v5 3/5] tracing: Use __free() for kprobe events to cleanup Masami Hiramatsu (Google)
2025-01-08 15:09 ` Steven Rostedt
2025-01-08 2:11 ` [PATCH v5 4/5] tracing/kprobes: Simplify __trace_kprobe_create() by removing gotos Masami Hiramatsu (Google)
2025-01-08 15:11 ` Steven Rostedt
2025-01-09 1:41 ` Masami Hiramatsu
2025-01-08 2:11 ` [PATCH v5 5/5] tracing: Adopt __free() and guard() for trace_fprobe.c Masami Hiramatsu (Google)
2025-01-08 15:07 ` Steven Rostedt
2025-01-09 1:43 ` Masami Hiramatsu [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=20250109104331.5a11a889c4d07b9ebddcadd3@kernel.org \
--to=mhiramat@kernel.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=ardb@kernel.org \
--cc=davem@davemloft.net \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=naveen@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tz.stoyanov@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).