tracing: Remove unnecessary copying of tr->current_trace
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 15 Jul 2023 14:12:14 +0000 (10:12 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sun, 30 Jul 2023 22:11:45 +0000 (18:11 -0400)
commit9182b519b8c9733e921165f93e63cfffc18d1e0a
tree1b298d42742543b86cca55e2ef2982d6d86372a7
parent00a8478f8f5c0201004240746dd74d69d86fc0c4
tracing: Remove unnecessary copying of tr->current_trace

The iterator allocated a descriptor to copy the current_trace. This was done
with the assumption that the function pointers might change. But this was a
false assuption, as it does not change. There's no reason to make a copy of the
current_trace and just use the pointer it points to. This removes needing to
manage freeing the descriptor. Worse yet, there's locations that the iterator
is used but does make a copy and just uses the pointer. This could cause the
actual pointer to the trace descriptor to be freed and not the allocated copy.

This is more of a clean up than a fix.

Link: https://lkml.kernel.org/r/20230715141348.135792275@goodmis.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Fixes: d7350c3f45694 ("tracing/core: make the read callbacks reentrants")
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c