aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2009-10-17 12:08:29 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-19 03:52:39 -0400
commitdc79959aaf80e518741657a702fa2727c86c1189 (patch)
tree39e7a00b90c972714657c74fd88d12759f36ea37 /tools/perf/builtin-top.c
parent210f9cb2cf2effca690271085f4bd6a3ea286e6c (diff)
perf top: Fix --delay_secs 0 division by zero
Add delay_secs sanity check to handle_keypress, this fixes a division by zero crash. Signed-off-by: Tim Blechmann <tim@klingt.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4AD9EBFD.106@klingt.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 37512e936235..a1b1d10912dc 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -686,6 +686,8 @@ static void handle_keypress(int c)
686 switch (c) { 686 switch (c) {
687 case 'd': 687 case 'd':
688 prompt_integer(&delay_secs, "Enter display delay"); 688 prompt_integer(&delay_secs, "Enter display delay");
689 if (delay_secs < 1)
690 delay_secs = 1;
689 break; 691 break;
690 case 'e': 692 case 'e':
691 prompt_integer(&print_entries, "Enter display entries (lines)"); 693 prompt_integer(&print_entries, "Enter display entries (lines)");