From: Steven Rostedt <rostedt@goodmis.org>
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.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_trigger.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 3b97c242b795..96aad82b1628 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -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);
--
2.51.0
On Tue, 2025-11-25 at 16:40 -0500, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> 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.
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Looks good to me.
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
> ---
> kernel/trace/trace_events_trigger.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
> index 3b97c242b795..96aad82b1628 100644
> --- a/kernel/trace/trace_events_trigger.c
> +++ b/kernel/trace/trace_events_trigger.c
> @@ -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);
On Wed, 03 Dec 2025 16:40:04 -0600 Tom Zanussi <zanussi@kernel.org> wrote: > > 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. > > > > Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> > > Looks good to me. > > Reviewed-by: Tom Zanussi <zanussi@kernel.org> Thanks for all the reviews, but I already did the pull request ;-) Although it hasn't been accepted yet and there's always a chance Linus may have an issue with one of the commits (I had a lot of commits this time, affecting various aspects of the code, but couldn't use topic branches due to too many conflicts). If it is rejected, I'll add your reviewed-by tags. -- Steve
On Wed, 2025-12-03 at 17:46 -0500, Steven Rostedt wrote: > On Wed, 03 Dec 2025 16:40:04 -0600 > Tom Zanussi <zanussi@kernel.org> wrote: > > > > 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. > > > > > > Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> > > > > Looks good to me. > > > > Reviewed-by: Tom Zanussi <zanussi@kernel.org> > > Thanks for all the reviews, but I already did the pull request ;-) > > Although it hasn't been accepted yet and there's always a chance Linus may > have an issue with one of the commits (I had a lot of commits this time, > affecting various aspects of the code, but couldn't use topic branches due > to too many conflicts). If it is rejected, I'll add your reviewed-by tags. > > -- Steve No problem, my fault for being so slow to get to these. :-/ Tom
© 2016 - 2026 Red Hat, Inc.