Linux Trace Kernel
 help / color / mirror / Atom feed
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [PATCH 03/10] tracing/probes: Remove redundant bounds check in trace_probe_compare_arg_type()
Date: Mon, 20 Jul 2026 19:43:57 +0900	[thread overview]
Message-ID: <178454423769.296567.6694636865644203423.stgit@devnote2> (raw)
In-Reply-To: <178454420994.296567.10239174745865301350.stgit@devnote2>

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

In trace_probe_compare_arg_type(), prior to entering the comparison loop,
a->nr_args and b->nr_args are checked for equality. Since the loop
condition is i < a->nr_args, i is guaranteed to be less than b->nr_args
inside the loop.

Remove the redundant (b->nr_args <= i) check.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 kernel/trace/trace_probe.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7568f5e68de7..91ba4490937b 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -2770,10 +2770,9 @@ int trace_probe_compare_arg_type(struct trace_probe *a, struct trace_probe *b)
 		return b->nr_args + 1;
 
 	for (i = 0; i < a->nr_args; i++) {
-		if ((b->nr_args <= i) ||
-		    ((a->args[i].type != b->args[i].type) ||
-		     (a->args[i].count != b->args[i].count) ||
-		     strcmp(a->args[i].name, b->args[i].name)))
+		if ((a->args[i].type != b->args[i].type) ||
+		    (a->args[i].count != b->args[i].count) ||
+		    strcmp(a->args[i].name, b->args[i].name))
 			return i + 1;
 	}
 


  parent reply	other threads:[~2026-07-20 10:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 01/10] tracing/probes: Remove duplicate MAX_ARRAY_LEN macro definition Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 02/10] tracing/probes: Remove redundant boolean conversion in trace_probe_has_single_file() Masami Hiramatsu (Google)
2026-07-20 10:43 ` Masami Hiramatsu (Google) [this message]
2026-07-20 10:44 ` [PATCH 04/10] tracing/probes: Remove unused parameter from parse_probe_var_retval() Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 05/10] tracing/probes: Cleanup pointer arithmetic in store_trace_entry_data() Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 06/10] tracing/probes: Simplify BTF_KIND_PTR case in fetch_type_from_btf_type() Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 07/10] tracing/fprobe: Remove redundant snprintf in trace_fprobe_match_command_head() Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 08/10] tracing/fprobe: Remove redundant memset in fentry_perf_func() Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 09/10] tracing/kprobe: Remove redundant memset in kprobe_perf_func() Masami Hiramatsu (Google)
2026-07-20 10:45 ` [PATCH 10/10] tracing/probes: Fix extra whitespace in trace_probe_kernel.h Masami Hiramatsu (Google)

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=178454423769.296567.6694636865644203423.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --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