# Re: \[PATCH v3 11/16\] tracing/filters: Check for trailing characters after newline in filter string

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2026-10-28 14:03:57 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/10/17817235
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/10/17814009/t.md

```text
On Wed, 28 Oct 2026 10:28:10 +0900
"Masami Hiramatsu (Google)" [ref] wrote:

> Hmm, IMHO, there is a bad implementation in __ftrace_set_clr_event_nolock().
> It should make a working copy of the filter string and pass it to
> apply_event_filter(). Or pass the filter string as `const char *`
> so that it is copied in the apply_event_filter() side. The ownership
> of the filter string is not clear here.

I noticed this when I applied the patch.

Yes, the correct solution is to pass in const char *filter to
__ftrace_set_clr_event_nolock() (I was planning on doing this after the
merge window closed). But no, making a copy in
__ftrace_set_clr_event_nolock() is *not* the right solution. There's
nothing in that function that modifies that string to suggest it needs to
make a copy of it.

The correct solution is to pass const char *filter to apply_event_filter()
and have *that* function do the copy. That was my plan to make a patch for.

-- Steve
```
