Commit c319a3a
committed
tracing: Fix using ret variable in tracing_set_tracer()
JIRA: https://issues.redhat.com/browse/RHEL-86682
commit 22bec11
Author: Steven Rostedt <rostedt@goodmis.org>
Date: Mon Jan 6 11:11:43 2025 -0500
tracing: Fix using ret variable in tracing_set_tracer()
When the function tracing_set_tracer() switched over to using the guard()
infrastructure, it did not need to save the 'ret' variable and would just
return the value when an error arised, instead of setting ret and jumping
to an out label.
When CONFIG_TRACER_SNAPSHOT is enabled, it had code that expected the
"ret" variable to be initialized to zero and had set 'ret' while holding
an arch_spin_lock() (not used by guard), and then upon releasing the lock
it would check 'ret' and exit if set. But because ret was only set when an
error occurred while holding the locks, 'ret' would be used uninitialized
if there was no error. The code in the CONFIG_TRACER_SNAPSHOT block should
be self contain. Make sure 'ret' is also set when no error occurred.
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250106111143.2f90ff65@gandalf.local.home
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202412271654.nJVBuwmF-lkp@intel.com/
Fixes: d33b10c ("tracing: Switch trace.c code over to use guard()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>1 parent e737114 commit c319a3a
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6134 | 6134 | | |
6135 | 6135 | | |
6136 | 6136 | | |
6137 | | - | |
6138 | | - | |
| 6137 | + | |
6139 | 6138 | | |
6140 | 6139 | | |
6141 | 6140 | | |
| |||
0 commit comments