[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6@git.kernel.org>
Date: Wed, 23 Mar 2011 09:43:16 GMT
From: tip-bot for Akihiro Nagai <akihiro.nagai.hw@...achi.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
mingo@...hat.com, akihiro.nagai.hw@...achi.com,
peterz@...radead.org, masami.hiramatsu.pt@...achi.com,
acme@...radead.org, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/urgent] perf top: Fix uninitialized 'counter' variable
Commit-ID: ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6
Gitweb: http://git.kernel.org/tip/ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6
Author: Akihiro Nagai <akihiro.nagai.hw@...achi.com>
AuthorDate: Wed, 23 Mar 2011 16:29:39 +0900
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 23 Mar 2011 10:38:32 +0100
perf top: Fix uninitialized 'counter' variable
builtin-top.c has an uninitialized variable.
gcc(version 4.5.1) warns about it and it results in build failure:
builtin-top.c: In function 'display_thread':
builtin-top.c:518:9: error: 'counter' may be used uninitialized
This situation can indeed trigger, if the getline() call in
prompt_integer() fails.
Signed-off-by: Akihiro Nagai <akihiro.nagai.hw@...achi.com>
Cc: Arnaldo Carvalho de Melo <acme@...radead.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
LKML-Reference: <20110323072939.11638.50173.stgit@...alhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/builtin-top.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 70f1075..676b4fb 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -515,7 +515,9 @@ static void handle_keypress(struct perf_session *session, int c)
break;
case 'E':
if (top.evlist->nr_entries > 1) {
- int counter;
+ /* Select 0 as the default event: */
+ int counter = 0;
+
fprintf(stderr, "\nAvailable events:");
list_for_each_entry(top.sym_evsel, &top.evlist->entries, node)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists