From: tip-bot for Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, akihiro.nagai.hw@hitachi.com,
peterz@infradead.org, masami.hiramatsu.pt@hitachi.com,
acme@infradead.org, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/urgent] perf top: Fix uninitialized 'counter' variable
Date: Wed, 23 Mar 2011 09:43:16 GMT [thread overview]
Message-ID: <tip-ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6@git.kernel.org> (raw)
In-Reply-To: <20110323072939.11638.50173.stgit@localhost6.localdomain6>
Commit-ID: ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6
Gitweb: http://git.kernel.org/tip/ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6
Author: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
AuthorDate: Wed, 23 Mar 2011 16:29:39 +0900
Committer: Ingo Molnar <mingo@elte.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@hitachi.com>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20110323072939.11638.50173.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.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)
prev parent reply other threads:[~2011-03-23 9:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 7:29 [PATCH -tip ] [BUGFIX] perf-top: Fix uninitialized variable Akihiro Nagai
2011-03-23 9:43 ` tip-bot for Akihiro Nagai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-ce2d17ca7f85dcade62cd608601a0d52ccdaf0e6@git.kernel.org \
--to=akihiro.nagai.hw@hitachi.com \
--cc=acme@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox