提交 dc79959a 编写于 作者: T Tim Blechmann 提交者: Ingo Molnar

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: NTim 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: NIngo Molnar <mingo@elte.hu>
上级 210f9cb2
...@@ -686,6 +686,8 @@ static void handle_keypress(int c) ...@@ -686,6 +686,8 @@ static void handle_keypress(int c)
switch (c) { switch (c) {
case 'd': case 'd':
prompt_integer(&delay_secs, "Enter display delay"); prompt_integer(&delay_secs, "Enter display delay");
if (delay_secs < 1)
delay_secs = 1;
break; break;
case 'e': case 'e':
prompt_integer(&print_entries, "Enter display entries (lines)"); prompt_integer(&print_entries, "Enter display entries (lines)");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册