All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
	mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [PATCH] tracing: probes: Fix to zero initialize a local variable
Date: Wed, 20 Mar 2024 17:10:38 +0900	[thread overview]
Message-ID: <171092223833.237219.17304490075697026697.stgit@devnote2> (raw)
In-Reply-To: <b010488e-68aa-407c-add0-3e059254aaa0@moroto.mountain>

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Fix to initialize 'val' local variable with zero.
Dan reported that Smatch static code checker reports an error that a local
'val' variable needs to be initialized. Actually, the 'val' is expected to
be initialized by FETCH_OP_ARG in the same loop, but it is not obvious. So
initialize it with zero.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/b010488e-68aa-407c-add0-3e059254aaa0@moroto.mountain/
Fixes: 25f00e40ce79 ("tracing/probes: Support $argN in return probe (kprobe and fprobe)")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 kernel/trace/trace_probe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 217169de0920..dfe3ee6035ec 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -839,7 +839,7 @@ int traceprobe_get_entry_data_size(struct trace_probe *tp)
 void store_trace_entry_data(void *edata, struct trace_probe *tp, struct pt_regs *regs)
 {
 	struct probe_entry_arg *earg = tp->entry_arg;
-	unsigned long val;
+	unsigned long val = 0;
 	int i;
 
 	if (!earg)


  parent reply	other threads:[~2024-03-20  8:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  7:19 [bug report] tracing/probes: Support $argN in return probe (kprobe and fprobe) Dan Carpenter
2024-03-19 14:10 ` Steven Rostedt
2024-03-19 14:39   ` Dan Carpenter
2024-03-20  3:44   ` Masami Hiramatsu
2024-03-20 13:22     ` Steven Rostedt
2024-03-20  8:10 ` Masami Hiramatsu (Google) [this message]
2024-03-20 13:26   ` [PATCH] tracing: probes: Fix to zero initialize a local variable Steven Rostedt
2024-03-20 13:27   ` Steven Rostedt
2024-03-20 22:56     ` Masami Hiramatsu

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=171092223833.237219.17304490075697026697.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-trace-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.