[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250107202236.6fbb4ad2a93e18f2db8e862f@kernel.org>
Date: Tue, 7 Jan 2025 20:22:36 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>, 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 v2 3/7] tracing: Use __free() for argv in dynevent
On Tue, 7 Jan 2025 01:03:27 +0900
"Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
>
> Use __free() for the args allocated by argv_split() in dynevent.
Lol, the same one has already done by Steve.
https://lore.kernel.org/linux-trace-kernel/20241220103313.4a74ec8e@gandalf.local.home/
Let me drop it.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> ---
> Changes in v3:
> - Rename to __free(argv_free).
> Changes in v2:
> - Rebased on probes/for-next, which reverts previous dynevent guard patch.
> ---
> kernel/trace/trace_dynevent.c | 23 ++++++++---------------
> 1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/kernel/trace/trace_dynevent.c b/kernel/trace/trace_dynevent.c
> index 4376887e0d8a..78242ea6fb30 100644
> --- a/kernel/trace/trace_dynevent.c
> +++ b/kernel/trace/trace_dynevent.c
> @@ -74,24 +74,20 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *type
> struct dyn_event *pos, *n;
> char *system = NULL, *event, *p;
> int argc, ret = -ENOENT;
> - char **argv;
> + char **argv __free(argv_free) = NULL;
>
> argv = argv_split(GFP_KERNEL, raw_command, &argc);
> if (!argv)
> return -ENOMEM;
>
> if (argv[0][0] == '-') {
> - if (argv[0][1] != ':') {
> - ret = -EINVAL;
> - goto out;
> - }
> + if (argv[0][1] != ':')
> + return -EINVAL;
> event = &argv[0][2];
> } else {
> event = strchr(argv[0], ':');
> - if (!event) {
> - ret = -EINVAL;
> - goto out;
> - }
> + if (!event)
> + return -EINVAL;
> event++;
> }
>
> @@ -101,10 +97,8 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *type
> event = p + 1;
> *p = '\0';
> }
> - if (!system && event[0] == '\0') {
> - ret = -EINVAL;
> - goto out;
> - }
> + if (!system && event[0] == '\0')
> + return -EINVAL;
>
> mutex_lock(&event_mutex);
> for_each_dyn_event_safe(pos, n) {
> @@ -120,8 +114,7 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *type
> }
> tracing_reset_all_online_cpus();
> mutex_unlock(&event_mutex);
> -out:
> - argv_free(argv);
> +
> return ret;
> }
>
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists