libtracefs: Fix tracefs_event_enable/disable() to not have open regex

[ Upstream de8592c0ef0b6ed8cedf19e8d0f21858b7d98f38 ]

Found that calling tracefs_event_enable/disable() will match all content
of the passed in strings and not just what is passed in.

That is, if you have two events, "open" and "open2", and call

 tracefs_event_enable(NULL, NULL, "open");

it will match both the "open" event as well as the "open2" event. This is
because the regex is open ended.

To fix this, add a '^' to the beginning of the match and a '$' to the end
(if they do not already exist).

Link: https://lore.kernel.org/linux-trace-devel/20210629164046.48f8b323@oasis.local.home

Fixes: fc94d1a8 ("libtracefs: Add tracefs_event_enable/disable() API")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 file changed