All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Blechmann <tim@klingt.org>
To: linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>
Subject: [PATCH] perf tools: delay_secs safety
Date: Sat, 17 Oct 2009 18:08:29 +0200	[thread overview]
Message-ID: <4AD9EBFD.106@klingt.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 228 bytes --]


add delay_secs sanity check to handle_keypress, fixes a division by
zero crash.

Signed-off-by: Tim Blechmann <tim@klingt.org>
---
 tools/perf/builtin-top.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-perf-tools-delay_secs-safety.patch --]
[-- Type: text/x-patch; name="0001-perf-tools-delay_secs-safety.patch", Size: 449 bytes --]

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 2d8806b..cc66286 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -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)");


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-10-17 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-17 16:08 Tim Blechmann [this message]
2009-10-19  7:56 ` [tip:perf/urgent] perf top: Fix --delay_secs 0 division by zero tip-bot for Tim Blechmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AD9EBFD.106@klingt.org \
    --to=tim@klingt.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.