perf top: Fix --delay_secs 0 division by zero
authorTim Blechmann <tim@klingt.org>
Sat, 17 Oct 2009 16:08:29 +0000 (18:08 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 19 Oct 2009 07:52:39 +0000 (09:52 +0200)
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>
tools/perf/builtin-top.c

index 37512e936235359aa4ebbf93d21831cce56750d7..a1b1d10912dceae2fcab280d41e03f28a60b3a82 100644 (file)
@@ -686,6 +686,8 @@ static void handle_keypress(int c)
        switch (c) {
                case 'd':
                        prompt_integer(&delay_secs, "Enter display delay");
+                       if (delay_secs < 1)
+                               delay_secs = 1;
                        break;
                case 'e':
                        prompt_integer(&print_entries, "Enter display entries (lines)");