From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/2] kernel-shark: Initialize the data-related fields of the model
Date: Thu, 18 Jul 2019 09:36:18 +0300 [thread overview]
Message-ID: <72ea5426-ea9e-7c18-e540-504638b0a562@gmail.com> (raw)
In-Reply-To: <20190717152744.50b450cf@gandalf.local.home>
On 17.07.19 г. 22:27 ч., Steven Rostedt wrote:
>
> And here's the version that claws-mail didn't line wrap :-p
>
> -- Steve
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 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@gmail.com
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204195
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> 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));
> }
>
> /**
>
Thanks!
Yordan
Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
next prev parent reply other threads:[~2019-07-18 6:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 8:53 [PATCH 0/2] Fixes for KS 1.0 Yordan Karadzhov (VMware)
2019-07-17 8:53 ` [PATCH 1/2] kernel-shark: Initialize the data-related fields of the model Yordan Karadzhov (VMware)
2019-07-17 12:37 ` Steven Rostedt
2019-07-17 12:42 ` Yordan Karadzhov (VMware)
2019-07-17 13:28 ` Steven Rostedt
2019-07-17 13:38 ` Yordan Karadzhov (VMware)
2019-07-17 19:26 ` Steven Rostedt
2019-07-17 19:27 ` Steven Rostedt
2019-07-18 6:36 ` Yordan Karadzhov (VMware) [this message]
2019-07-17 8:53 ` [PATCH 2/2] kernel-shark: Always check if data is loaded before changing the graphs Yordan Karadzhov (VMware)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=72ea5426-ea9e-7c18-e540-504638b0a562@gmail.com \
--to=y.karadz@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).