[PATCH 1/2] kernel-shark: Initialize the data-related fields of the model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is particularly important to initialize to zero the "data_size" field
because its value is used when doing operations like scroll or zoom to
check if data has been loaded or not. Not having "data_size" set to zero
can cause segfault (as reported by Steven).

Reported-By: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204195
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx>
---
 kernel-shark/src/libkshark-model.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index 18f9c69..fd4d876 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -36,6 +36,9 @@ void ksmodel_init(struct kshark_trace_histo *histo)
 	 * Initialize an empty histo. The histo will have no bins and will
 	 * contain no data.
 	 */
+	histo->data_size = 0;
+	histo->data = NULL;
+
 	histo->bin_size = 0;
 	histo->min = 0;
 	histo->max = 0;
-- 
2.20.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux