[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <173594531843.1055889.15079784465215693664.stgit@devnote2>
Date: Sat, 4 Jan 2025 08:01:58 +0900
From: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
"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: [PATCH 3/6] tracing: Use __free() for argv in dynevent
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Use __free() for the args allocated by argv_split() in dynevent.
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
---
kernel/trace/trace_dynevent.c | 47 +++++++++++++++++------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/kernel/trace/trace_dynevent.c b/kernel/trace/trace_dynevent.c
index eb8f669c15e1..ec8fa7b143e2 100644
--- a/kernel/trace/trace_dynevent.c
+++ b/kernel/trace/trace_dynevent.c
@@ -73,24 +73,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) = 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++;
}
@@ -100,27 +96,22 @@ 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;
- scoped_guard(mutex, &event_mutex) {
- for_each_dyn_event_safe(pos, n) {
- if (type && type != pos->ops)
- continue;
- if (!pos->ops->match(system, event,
- argc - 1, (const char **)argv + 1, pos))
- continue;
-
- ret = pos->ops->free(pos);
- if (ret)
- break;
- }
- tracing_reset_all_online_cpus();
+ guard(mutex)(&event_mutex);
+ for_each_dyn_event_safe(pos, n) {
+ if (type && type != pos->ops)
+ continue;
+ if (!pos->ops->match(system, event,
+ argc - 1, (const char **)argv + 1, pos))
+ continue;
+
+ ret = pos->ops->free(pos);
+ if (ret)
+ break;
}
-out:
- argv_free(argv);
+ tracing_reset_all_online_cpus();
return ret;
}
Powered by blists - more mailing lists