[Crash-utility] [PATCH] trace: don't use uninited max_tr_ring_buffer

Rabin Vincent rabin.vincent at axis.com
Tue Jan 31 09:18:37 UTC 2017


From: Rabin Vincent <rabinv at axis.com>

This max buffer is not available in all configurations of the kernel so
we shouldn't attempt to use the unitialized max_tr_ring_buffer variable.
A similar check existed previously before the recent rework of the trace
extension to support multiple buffers.
---
 extensions/trace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/extensions/trace.c b/extensions/trace.c
index 51df98d..22039a9 100644
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -487,6 +487,9 @@ static int ftrace_init_trace(struct trace_instance *ti, ulong instance_addr)
 			ti->pages) < 0)
 		goto out_fail;
 
+	if (!ti->max_tr_ring_buffer)
+		return 0;
+
 	ti->max_tr_buffers = calloc(sizeof(*ti->max_tr_buffers), nr_cpu_ids);
 	if (ti->max_tr_buffers == NULL)
 		goto out_fail;
-- 
2.1.4




More information about the Crash-utility mailing list