Skip to contentSkip to conversation

perf evlist: Explicititely initialize input_name

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 24, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  a1d44b9acdf7b2820ef762846150b4d13b84e075
Gitweb:     http://git.kernel.org/tip/a1d44b9acdf7b2820ef762846150b4d13b84e075
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Wed, 23 May 2012 21:47:51 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 23 May 2012 21:47:51 -0300

perf evlist: Explicititely initialize input_name

It was a global variable, so it was initialized, implicitely, to zero by being placed in the bss.

Now it is just a local variable that is then passed to the __cmd_evlist routine, so it must be explicitely set to NULL.

The problem manifested on a Fedora 17 system, using:

gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC)

But not on several other systems, by luck.

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/builtin-evlist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-evlist.c +1 -1
index e52d77e..acd78dc 100644
@@ -116,7 +116,7 @@ static const char * const evlist_usage[] = {
 int cmd_evlist(int argc, const char **argv, const char *prefix __used)
 {
 	struct perf_attr_details details = { .verbose = false, };
-	const char *input_name;
+	const char *input_name = NULL;
 	const struct option options[] = {
 		OPT_STRING('i', "input", &input_name, "file",
 			    "Input file name"),