[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251117184409.42831-10-wander@redhat.com>
Date: Mon, 17 Nov 2025 15:41:16 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Wander Lairson Costa <wander@...hat.com>,
Tomas Glozar <tglozar@...hat.com>,
Ivan Pravdin <ipravdin.official@...il.com>,
Crystal Wood <crwood@...hat.com>,
John Kacur <jkacur@...hat.com>,
Costa Shulyupin <costa.shul@...hat.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
linux-trace-kernel@...r.kernel.org (open list:Real-time Linux Analysis (RTLA) tools),
linux-kernel@...r.kernel.org (open list),
bpf@...r.kernel.org (open list:BPF [MISC]:Keyword:(?:\b|_)bpf(?:\b|_))
Subject: [rtla 09/13] rtla: Exit if trace output action fails
The actions_add_trace_output() function can fail if it's unable to
allocate memory for a new action. Currently, the return value is not
checked, and the program continues to run, which can lead to
unexpected behavior.
Add a check to the return value of actions_add_trace_output() and
exit with a proper error message if it fails.
Signed-off-by: Wander Lairson Costa <wander@...hat.com>
---
tools/tracing/rtla/src/timerlat_hist.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index f14fc56c5b4a5..39a14c4e07de8 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -1070,8 +1070,10 @@ static struct common_params
}
}
- if (trace_output)
- actions_add_trace_output(¶ms->common.threshold_actions, trace_output);
+ if (trace_output && actions_add_trace_output(¶ms->common.threshold_actions, trace_output)) {
+ err_msg("Could not add a new trace output");
+ exit(EXIT_FAILURE);
+ }
if (geteuid()) {
err_msg("rtla needs root permission\n");
--
2.51.1
Powered by blists - more mailing lists