Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1503268
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables |
| Date | 2016-10-18 20:10 +0200 |
| Message-ID | <stGZP-5pH-7@gated-at.bofh.it> (permalink) |
| References | <stgVH-4zx-5@gated-at.bofh.it> <stgVI-4zx-39@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
[PATCH 2/3] tools lib traceevent: Check the return value of asprintf Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
Re: [PATCH 2/3] tools lib traceevent: Check the return value of asprintf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-18 20:00 +0200
Re: [PATCH 2/3] tools lib traceevent: Check the return value of asprintf Namhyung Kim <namhyung@kernel.org> - 2016-10-19 02:30 +0200
[PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
Re: [PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-18 20:10 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Namhyung Kim <namhyung@kernel.org> - 2016-10-18 04:10 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-18 17:40 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 19:50 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 20:10 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 20:10 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 21:30 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 21:30 +0200
Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 20:30 +0200
csiph-web