aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-07-17 14:55:36 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-07-18 17:04:56 -0400
commiteb1baa7c5d9934e128080a8594475beaba9cb6c6 (patch)
treef4d4bce27c09c6a217fde56cd5c9c50f8a48d6f6
parente9ad1b94a320dc8f380924caf4bfc93654d3020d (diff)
downloadtrace-cmd-eb1baa7c5d9934e128080a8594475beaba9cb6c6.tar.gz
kernel-shark: Initialize all fields of struct kshark_trace_histo
The function ksmodel_init() is to initialize the kshark_trace_histo structure to zero. Currently it does it via each field. It is safer to use memset() that will guarantee that the entire structure is set to zeros or NULLs if new fields are added. This is required because there's places in the code that check if a field is NULL or zero to determine if it should be set or not. Link: http://lkml.kernel.org/r/20190717085306.12393-2-y.karadz@gmail.com Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204195 Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel-shark/src/libkshark-model.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c
index 18f9c691..6c54e1e1 100644
--- a/kernel-shark/src/libkshark-model.c
+++ b/kernel-shark/src/libkshark-model.c
@@ -36,13 +36,7 @@ void ksmodel_init(struct kshark_trace_histo *histo)
* Initialize an empty histo. The histo will have no bins and will
* contain no data.
*/
- histo->bin_size = 0;
- histo->min = 0;
- histo->max = 0;
- histo->n_bins = 0;
-
- histo->bin_count = NULL;
- histo->map = NULL;
+ memset(histo, 0, sizeof(*histo));
}
/**