Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Clear trace_state when starting trace

Clear trace_state data structure when starting trace
in __synth_event_trace_start() internal function.

Currently trace_state is initialized only in the
synth_event_trace_start() API, but the trace_state
in synth_event_trace() and synth_event_trace_array()
are on the stack without initialization.
This means those APIs will see wrong parameters and
wil skip closing process in __synth_event_trace_end()
because trace_state->disabled may be !0.

Link: http://lkml.kernel.org/r/158193315899.8868.1781259176894639952.stgit@devnote2

Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Masami Hiramatsu and committed by
Steven Rostedt (VMware)
7ab215f2 08d9e686

+2 -2
+2 -2
kernel/trace/trace_events_hist.c
··· 1824 1824 int entry_size, fields_size = 0; 1825 1825 int ret = 0; 1826 1826 1827 + memset(trace_state, '\0', sizeof(*trace_state)); 1828 + 1827 1829 /* 1828 1830 * Normal event tracing doesn't get called at all unless the 1829 1831 * ENABLED bit is set (which attaches the probe thus allowing ··· 2064 2062 2065 2063 if (!trace_state) 2066 2064 return -EINVAL; 2067 - 2068 - memset(trace_state, '\0', sizeof(*trace_state)); 2069 2065 2070 2066 ret = __synth_event_trace_start(file, trace_state); 2071 2067 if (ret == -ENOENT)