mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing/fprobe: Call trace_probe_log_set_index(0) only once in __trace_fprobe_create()
@ 2024-09-26 14:31 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2024-09-26 14:31 UTC (permalink / raw)
  To: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers, Steven Rostedt
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 26 Sep 2024 16:22:32 +0200

A trace_probe_log_set_index(0) call was immediately used after a condition
check in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/trace/trace_fprobe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 62e6a8f4aae9..752d1f163258 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -1047,13 +1047,12 @@ static int __trace_fprobe_create(int argc, const char *argv[])
 	if (ret < 0)
 		goto parse_error;

+	trace_probe_log_set_index(0);
 	if (!is_return && maxactive) {
-		trace_probe_log_set_index(0);
 		trace_probe_log_err(1, BAD_MAXACT_TYPE);
 		goto parse_error;
 	}

-	trace_probe_log_set_index(0);
 	if (event) {
 		ret = traceprobe_parse_event_name(&event, &group, gbuf,
 						  event - argv[0]);
--
2.46.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-26 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-26 14:31 [PATCH] tracing/fprobe: Call trace_probe_log_set_index(0) only once in __trace_fprobe_create() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®