From: Tim Blechmann Date: Sat, 17 Oct 2009 16:08:29 +0000 (+0200) Subject: perf top: Fix --delay_secs 0 division by zero X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=dc79959aaf80e518741657a702fa2727c86c1189;p=deliverable%2Flinux.git 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 Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Mike Galbraith Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker LKML-Reference: <4AD9EBFD.106@klingt.org> Signed-off-by: Ingo Molnar --- 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) 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)");