2009-10-17 16:09:01

by Tim Blechmann

[permalink] [raw]
Subject: [PATCH] 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(-)


Attachments:
0001-perf-tools-delay_secs-safety.patch (435.00 B)
signature.asc (197.00 B)
OpenPGP digital signature
Download all attachments

2009-10-19 07:57:28

by Tim Blechmann

[permalink] [raw]
Subject: [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(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 37512e9..a1b1d10 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)");