From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Honggyu Kim <hong.gyu.kim@lge.com>,
namhyung@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables
Date: Tue, 18 Oct 2016 14:59:35 -0300 [thread overview]
Message-ID: <20161018175935.GX12815@kernel.org> (raw)
In-Reply-To: <20161017141712.11932-3-hong.gyu.kim@lge.com>
One more.
Em Mon, Oct 17, 2016 at 11:17:12PM +0900, Honggyu Kim escreveu:
> This patch fixes uninitialized variables to remove remaining compiler
> warnings as follows:
>
> event-parse.c: In function ‘pevent_find_event_by_name’:
> event-parse.c:3513:21: warning: ‘event’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> pevent->last_event = event;
> ^
> event-parse.c: In function ‘pevent_data_lat_fmt’:
> event-parse.c:5156:20: warning: ‘migrate_disable’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> trace_seq_printf(s, "%d", migrate_disable);
> ^
> event-parse.c:5163:20: warning: ‘lock_depth’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> trace_seq_printf(s, "%d", lock_depth);
> ^
> event-parse.c: In function ‘pevent_event_info’:
> event-parse.c:5060:18: warning: ‘len_arg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> print_str_arg(&p, data, size, event,
> ^
> event-parse.c:4846:6: note: ‘len_arg’ was declared here
> int len_arg;
> ^
> ...
> kbuffer-parse.c: In function ‘__old_next_event’:
> kbuffer-parse.c:339:27: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> kbuf->next = kbuf->index + length;
> ^
> kbuffer-parse.c:297:15: note: ‘length’ was declared here
> unsigned int length;
> ^
>
> Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
> ---
> tools/lib/traceevent/event-parse.c | 8 ++++----
> tools/lib/traceevent/kbuffer-parse.c | 2 +-
> tools/lib/traceevent/plugin_function.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 664c90c..2fb9338 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -3490,7 +3490,7 @@ struct event_format *
> pevent_find_event_by_name(struct pevent *pevent,
> const char *sys, const char *name)
> {
> - struct event_format *event;
> + struct event_format *event = NULL;
> int i;
>
> if (pevent->last_event &&
> @@ -4843,7 +4843,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
> char format[32];
> int show_func;
> int len_as_arg;
> - int len_arg;
> + int len_arg = 0;
> int len;
> int ls;
>
> @@ -5102,8 +5102,8 @@ void pevent_data_lat_fmt(struct pevent *pevent,
> static int migrate_disable_exists;
> unsigned int lat_flags;
> unsigned int pc;
> - int lock_depth;
> - int migrate_disable;
> + int lock_depth = -1;
> + int migrate_disable = 0;
> int hardirq;
> int softirq;
> void *data = record->data;
> diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
> index 65984f1..fc8f20c 100644
> --- a/tools/lib/traceevent/kbuffer-parse.c
> +++ b/tools/lib/traceevent/kbuffer-parse.c
> @@ -294,7 +294,7 @@ static unsigned int old_update_pointers(struct kbuffer *kbuf)
> unsigned int type;
> unsigned int len;
> unsigned int delta;
> - unsigned int length;
> + unsigned int length = 0;
> void *ptr = kbuf->data + kbuf->curr;
>
> type_len_ts = read_4(kbuf, ptr);
> diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c
> index a00ec19..42dbf73 100644
> --- a/tools/lib/traceevent/plugin_function.c
> +++ b/tools/lib/traceevent/plugin_function.c
> @@ -130,7 +130,7 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record,
> unsigned long long pfunction;
> const char *func;
> const char *parent;
> - int index;
> + int index = 0;
>
> if (pevent_get_field_val(s, event, "ip", record, &function, 1))
> return trace_seq_putc(s, '!');
> --
> 2.10.0.rc2.dirty
next prev parent reply other threads:[~2016-10-18 17:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 14:17 [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Honggyu Kim
2016-10-17 14:17 ` [PATCH 2/3] tools lib traceevent: Check the return value of asprintf Honggyu Kim
2016-10-18 17:59 ` Arnaldo Carvalho de Melo
2016-10-19 0:25 ` Namhyung Kim
2016-10-17 14:17 ` [PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables Honggyu Kim
2016-10-18 17:59 ` Arnaldo Carvalho de Melo [this message]
2016-10-18 2:01 ` [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Namhyung Kim
2016-10-18 15:29 ` Steven Rostedt
2016-10-19 17:48 ` Arnaldo Carvalho de Melo
2016-10-19 18:05 ` Arnaldo Carvalho de Melo
2016-10-19 18:06 ` Arnaldo Carvalho de Melo
2016-10-19 19:26 ` Steven Rostedt
2016-10-19 19:21 ` Steven Rostedt
2016-10-19 18:21 ` Steven Rostedt
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=20161018175935.GX12815@kernel.org \
--to=acme@kernel.org \
--cc=hong.gyu.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@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