perf tools: delay_secs safety
PATCH 1/1 perf tools: delay_secs safety
add delay_secs sanity check to handle_keypress, fixes a division by zero crash.
Signed-off-by Tim Blechmann <[email protected]>
--- tools/perf/builtin-top.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +2 -0
@@ -663,6 +663,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)" );
[tip:perf/urgent] perf top: Fix --delay_secs 0 division by zero
Commit-ID: dc79959aaf80e518741657a702fa2727c86c1189 Gitweb: http://git.kernel.org/tip/dc79959aaf80e518741657a702fa2727c86c1189 Author: Tim Blechmann <[email protected]> AuthorDate: Sat, 17 Oct 2009 18:08:29 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 19 Oct 2009 09:52:39 +0200
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 <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- tools/perf/builtin-top.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +2 -0
@@ -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)" );