public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: rostedt@goodmis.org, mhiramat@kernel.org
Cc: mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Subject: [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer()
Date: Tue,  7 Jan 2025 18:29:20 +0530	[thread overview]
Message-ID: <20250107125920.45855-1-dheeraj.linuxdev@gmail.com> (raw)

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


             reply	other threads:[~2025-01-07 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 12:59 Dheeraj Reddy Jonnalagadda [this message]
2025-01-07 13:39 ` [PATCH kernel-next] tracing: Fix uninitialized variable in tracing_set_tracer() Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250107125920.45855-1-dheeraj.linuxdev@gmail.com \
    --to=dheeraj.linuxdev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox