* [PATCH] perf tools: Shut up compiler warning
@ 2009-10-19 16:56 Arnaldo Carvalho de Melo
2009-10-20 5:54 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-10-19 16:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Steven Rostedt,
Peter Zijlstra, Frederic Weisbecker
cc1: warnings being treated as errors
util/trace-event-parse.c: In function ‘parse_ftrace_printk’:
util/trace-event-parse.c:289: warning: ‘fmt’ may be used uninitialized in this function
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/trace-event-parse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 4b61b49..0b8a01b 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -286,7 +286,7 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
char *line;
char *next = NULL;
char *addr_str;
- char *fmt;
+ char *fmt = NULL;
int i;
line = strtok_r(file, "\n", &next);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools: Shut up compiler warning
2009-10-19 16:56 [PATCH] perf tools: Shut up compiler warning Arnaldo Carvalho de Melo
@ 2009-10-20 5:54 ` Ingo Molnar
2009-10-20 13:19 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2009-10-20 5:54 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Steven Rostedt, Peter Zijlstra, Frederic Weisbecker
* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> cc1: warnings being treated as errors
> util/trace-event-parse.c: In function ‘parse_ftrace_printk’:
> util/trace-event-parse.c:289: warning: ‘fmt’ may be used uninitialized in this function
>
> Cc: Steven Rostedt <srostedt@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/util/trace-event-parse.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
> index 4b61b49..0b8a01b 100644
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -286,7 +286,7 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
> char *line;
> char *next = NULL;
> char *addr_str;
> - char *fmt;
> + char *fmt = NULL;
> int i;
>
> line = strtok_r(file, "\n", &next);
Actually, this might be a real bug that GCC pointed out: what makes sure
that strtok_r() does not return a NULL (no more tokens) and hence fmt
remains NULL (crashing the rest of the parser)?
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools: Shut up compiler warning
2009-10-20 5:54 ` Ingo Molnar
@ 2009-10-20 13:19 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2009-10-20 13:19 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra,
Frederic Weisbecker
On Tue, 2009-10-20 at 07:54 +0200, Ingo Molnar wrote:
> * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
>
> > cc1: warnings being treated as errors
> > util/trace-event-parse.c: In function ‘parse_ftrace_printk’:
> > util/trace-event-parse.c:289: warning: ‘fmt’ may be used uninitialized in this function
> >
> > Cc: Steven Rostedt <srostedt@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> > tools/perf/util/trace-event-parse.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
> > index 4b61b49..0b8a01b 100644
> > --- a/tools/perf/util/trace-event-parse.c
> > +++ b/tools/perf/util/trace-event-parse.c
> > @@ -286,7 +286,7 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
> > char *line;
> > char *next = NULL;
> > char *addr_str;
> > - char *fmt;
> > + char *fmt = NULL;
> > int i;
> >
> > line = strtok_r(file, "\n", &next);
>
> Actually, this might be a real bug that GCC pointed out: what makes sure
> that strtok_r() does not return a NULL (no more tokens) and hence fmt
> remains NULL (crashing the rest of the parser)?
Ug, yeah that's a bug. That was one of the later changes I did at night.
I'll go look at it and see how it should really be.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-20 13:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19 16:56 [PATCH] perf tools: Shut up compiler warning Arnaldo Carvalho de Melo
2009-10-20 5:54 ` Ingo Molnar
2009-10-20 13:19 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox