[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1648623748-8833-1-git-send-email-baihaowen@meizu.com>
Date: Wed, 30 Mar 2022 15:02:28 +0800
From: Haowen Bai <baihaowen@...zu.com>
To: Daniel Bristot de Oliveira <bristot@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>
CC: Haowen Bai <baihaowen@...zu.com>,
<linux-trace-devel@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] rtla/osnoise: avoid NULL pointer dereference on out
record is NULL and go out but dereference record->trace.
report by coccicheck:
tools/tracing/rtla/src/osnoise_top.c:650:31-36: ERROR:
record is NULL but dereferenced.
Signed-off-by: Haowen Bai <baihaowen@...zu.com>
---
tools/tracing/rtla/src/osnoise_top.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 72c2fd6..8cb185e 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -572,7 +572,7 @@ int osnoise_top_main(int argc, char **argv)
retval = osnoise_top_apply_config(tool, params);
if (retval) {
err_msg("Could not apply config\n");
- goto out_top;
+ goto out_top_pre;
}
trace = &tool->trace;
@@ -580,14 +580,14 @@ int osnoise_top_main(int argc, char **argv)
retval = enable_osnoise(trace);
if (retval) {
err_msg("Failed to enable osnoise tracer\n");
- goto out_top;
+ goto out_top_pre;
}
if (params->set_sched) {
retval = set_comm_sched_attr("osnoise/", ¶ms->sched_param);
if (retval) {
err_msg("Failed to set sched parameters\n");
- goto out_top;
+ goto out_top_pre;
}
}
@@ -597,7 +597,7 @@ int osnoise_top_main(int argc, char **argv)
record = osnoise_init_trace_tool("osnoise");
if (!record) {
err_msg("Failed to enable the trace instance\n");
- goto out_top;
+ goto out_top_pre;
}
if (params->events) {
@@ -648,6 +648,7 @@ int osnoise_top_main(int argc, char **argv)
out_top:
trace_events_destroy(&record->trace, params->events);
+out_top_pre:
params->events = NULL;
osnoise_free_top(tool->data);
osnoise_destroy_tool(record);
--
2.7.4
Powered by blists - more mailing lists