perf tools: Shut up compiler warning
PATCH 1/1 perf tools: Shut up compiler warning
cc1: warnings being treated as errorsutil/trace-event-parse.c: In function ‘parse_ftrace_printk’:util/trace-event-parse.c:289: warning: ‘fmt’ may be used uninitialized in this function
--- tools/perf/util/trace-event-parse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/trace-event-parse.c +1 -1
@@ -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);
Signature · 1 line
1.5.5.1
Quoted 17 lines · Arnaldo Carvalho de Melo
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 functionCc Steven Rostedt <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Frederic Weisbecker <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/perf/util/trace-event-parse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/util/trace-event-parse.c +0
-0
tools/perf/util/trace-event-parse.c void parse_ftrace_printk(char *file, unsigned int size __unused) · line 292
Quoted 8 lines
tools/perf/util/trace-event-parse.c +1
-1@@ -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
Quoted 26 lines · Ingo Molnar
Quoted 24 lines · Arnaldo Carvalho de Melo
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 functionCc Steven Rostedt <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Frederic Weisbecker <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/perf/util/trace-event-parse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/util/trace-event-parse.c +1
-1@@ -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;
Quoted 5 lines
tools/perf/util/trace-event-parse.c void parse_ftrace_printk(char *file, unsigned int size __unused) · line 292
Quoted 1 line
tools/perf/util/trace-event-parse.c +0
-0line =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