From: tip-bot for Pierre Habouzit <pierre.habouzit@intersec.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, a.p.zijlstra@chello.nl,
pierre.habouzit@intersec.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/urgent] perf util: Fix do_read() to fail on EOF instead of busy-looping
Date: Fri, 7 Aug 2009 15:09:52 GMT [thread overview]
Message-ID: <tip-47efff9a9b958f1c459a4c669168be0de474a9e3@git.kernel.org> (raw)
In-Reply-To: <1249647361-11582-2-git-send-email-pierre.habouzit@intersec.com>
Commit-ID: 47efff9a9b958f1c459a4c669168be0de474a9e3
Gitweb: http://git.kernel.org/tip/47efff9a9b958f1c459a4c669168be0de474a9e3
Author: Pierre Habouzit <pierre.habouzit@intersec.com>
AuthorDate: Fri, 7 Aug 2009 14:16:00 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 Aug 2009 17:08:17 +0200
perf util: Fix do_read() to fail on EOF instead of busy-looping
While toying with perf, I've noticed that perf record can
easily enter a busy loop when doing something as silly as:
$ perf record -A ls
Yeah, do_read here really wants to read a known size, not being
able to should die(), not busy-loop ;)
That was the cause for the bug.
Signed-off-by: Pierre Habouzit <pierre.habouzit@intersec.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1249647361-11582-2-git-send-email-pierre.habouzit@intersec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
| 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 95a44bc..b92a457 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -185,6 +185,8 @@ static void do_read(int fd, void *buf, size_t size)
if (ret < 0)
die("failed to read");
+ if (ret == 0)
+ die("failed to read: missing data");
size -= ret;
buf += ret;
next prev parent reply other threads:[~2009-08-07 15:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-07 12:15 perf-record fix and UI improvement Pierre Habouzit
2009-08-07 12:16 ` [PATCH 1/2] perf util: do_read should fail on EOF instead of busy-looping Pierre Habouzit
2009-08-07 12:16 ` [PATCH 2/2] perf-record: improve -A UI for empty or non-existent perf.data Pierre Habouzit
2009-08-07 15:10 ` [tip:perfcounters/urgent] perf record: Fix the " tip-bot for Pierre Habouzit
2009-08-07 15:09 ` tip-bot for Pierre Habouzit [this message]
2009-08-07 12:28 ` perf-record fix and UI improvement Pierre Habouzit
2009-08-07 13:01 ` Peter Zijlstra
2009-08-07 13:59 ` Pierre Habouzit
2009-08-07 15:09 ` Ingo Molnar
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=tip-47efff9a9b958f1c459a4c669168be0de474a9e3@git.kernel.org \
--to=pierre.habouzit@intersec.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®