And here's the version that claws-mail didn't line wrap :-p -- Steve From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> Subject: [PATCH] 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@xxxxxxxxx Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204195 Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- kernel-shark/src/libkshark-model.c | 8 +------- 1 file changed, 1 insertion(+), 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)); } /** -- 2.20.1
![]() |