* [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer()
@ 2025-01-07 12:59 Dheeraj Reddy Jonnalagadda
2025-01-07 13:39 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Dheeraj Reddy Jonnalagadda @ 2025-01-07 12:59 UTC (permalink / raw)
To: rostedt, mhiramat
Cc: mathieu.desnoyers, linux-kernel, linux-trace-kernel,
Dheeraj Reddy Jonnalagadda
Fix an issue in the tracing_set_tracer() where the variable ret could
be used uninitialized under certain conditions. Specifically, when
t->use_max_tr is true but tr->cond_snapshot is false, the code would
check the value of ret without first initializing it.
Fixes: a35873a0993b ("tracing: Add conditional snapshot")
Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602786
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
kernel/trace/trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a04348ab7ccc..28f111c5b3a5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6079,7 +6079,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
#ifdef CONFIG_TRACER_MAX_TRACE
bool had_max_tr;
#endif
- int ret;
+ int ret = 0;
guard(mutex)(&trace_types_lock);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer()
2025-01-07 12:59 [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer() Dheeraj Reddy Jonnalagadda
@ 2025-01-07 13:39 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2025-01-07 13:39 UTC (permalink / raw)
To: Dheeraj Reddy Jonnalagadda
Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel
On Tue, 7 Jan 2025 18:29:20 +0530
Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com> wrote:
> Fix an issue in the tracing_set_tracer() where the variable ret could
> be used uninitialized under certain conditions. Specifically, when
> t->use_max_tr is true but tr->cond_snapshot is false, the code would
> check the value of ret without first initializing it.
>
> Fixes: a35873a0993b ("tracing: Add conditional snapshot")
> Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602786
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> ---
> kernel/trace/trace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index a04348ab7ccc..28f111c5b3a5 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6079,7 +6079,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
> #ifdef CONFIG_TRACER_MAX_TRACE
> bool had_max_tr;
> #endif
> - int ret;
> + int ret = 0;
>
> guard(mutex)(&trace_types_lock);
>
Incorrect fix. The actual fix is pending:
https://lore.kernel.org/all/20250106111143.2f90ff65@gandalf.local.home/
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-07 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 12:59 [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer() Dheeraj Reddy Jonnalagadda
2025-01-07 13:39 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox