From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
linux-trace-kernel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH v4 2/4] tracing/probes: Fix not to count error code to total length
Date: Tue, 11 Jul 2023 11:11:33 +0900 [thread overview]
Message-ID: <168904149337.2908673.1200969484356641870.stgit@mhiramat.roam.corp.google.com> (raw)
In-Reply-To: <168904147563.2908673.18054267804278861545.stgit@mhiramat.roam.corp.google.com>
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Fix not to count the error code (which is minus value) to the total
used length of array, because it can mess up the return code of
process_fetch_insn_bottom(). Also clear the 'ret' value because it
will be used for calculating next data_loc entry.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/
Fixes: 9b960a38835f ("tracing: probeevent: Unify fetch_insn processing common part")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes in v2:
- Check and clear ret only for the array argument.
---
kernel/trace/trace_probe_tmpl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
index 4735c5cb76fa..ed9d57c6b041 100644
--- a/kernel/trace/trace_probe_tmpl.h
+++ b/kernel/trace/trace_probe_tmpl.h
@@ -204,6 +204,8 @@ process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val,
array:
/* the last stage: Loop on array */
if (code->op == FETCH_OP_LP_ARRAY) {
+ if (ret < 0)
+ ret = 0;
total += ret;
if (++i < code->param) {
code = s3;
next prev parent reply other threads:[~2023-07-11 2:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 2:11 [PATCH v4 0/4] tracing/probes: Fix bugs in process_fetch_insn Masami Hiramatsu (Google)
2023-07-11 2:11 ` [PATCH v4 1/4] tracing/probes: Fix to avoid double count of the string length on the array Masami Hiramatsu (Google)
2023-07-11 2:11 ` Masami Hiramatsu (Google) [this message]
2023-07-11 2:11 ` [PATCH v4 3/4] Revert "tracing: Add "(fault)" name injection to kernel probes" Masami Hiramatsu (Google)
2023-07-11 2:11 ` [PATCH v4 4/4] tracing/probes: Fix to record 0-length data_loc in fetch_store_string*() if fails Masami Hiramatsu (Google)
2023-07-11 3:34 ` Steven Rostedt
2023-07-11 4: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=168904149337.2908673.1200969484356641870.stgit@mhiramat.roam.corp.google.com \
--to=mhiramat@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox