]> Gentwo Git Trees - linux/.git/commitdiff
tracing: Use strim() in trigger_process_regex() instead of skip_spaces()
authorSteven Rostedt <rostedt@goodmis.org>
Tue, 25 Nov 2025 21:40:07 +0000 (16:40 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 26 Nov 2025 20:13:30 +0000 (15:13 -0500)
The function trigger_process_regex() is called by a few functions, where
only one calls strim() on the buffer passed to it. That leaves the other
functions not trimming the end of the buffer passed in and making it a
little inconsistent.

Remove the strim() from event_trigger_regex_write() and have
trigger_process_regex() use strim() instead of skip_spaces(). The buff
variable is not passed in as const, so it can be modified.

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Link: https://patch.msgid.link/20251125214032.323747707@kernel.org
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_trigger.c

index 3b97c242b7954f0409552df6a12b8163d4d24feb..96aad82b162835172e790251361d7c98eff176d1 100644 (file)
@@ -308,7 +308,8 @@ int trigger_process_regex(struct trace_event_file *file, char *buff)
        char *command, *next;
        struct event_command *p;
 
-       next = buff = skip_spaces(buff);
+       next = buff = strim(buff);
+
        command = strsep(&next, ": \t");
        if (next) {
                next = skip_spaces(next);
@@ -345,8 +346,6 @@ static ssize_t event_trigger_regex_write(struct file *file,
        if (IS_ERR(buf))
                return PTR_ERR(buf);
 
-       strim(buf);
-
        guard(mutex)(&event_mutex);
 
        event_file = event_file_file(file);