From: Borislav Petkov <bp@alien8.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf-record: Check correct pid when forking
Date: Mon, 31 May 2010 23:40:15 +0200 [thread overview]
Message-ID: <20100531214015.GA27050@liondog.tnic> (raw)
In-Reply-To: <20100531212723.GH5157@nowhere>
From: Frederic Weisbecker <fweisbec@gmail.com>
Date: Mon, May 31, 2010 at 11:27:26PM +0200
Hi Frederic :),
> On Mon, May 31, 2010 at 11:18:18PM +0200, Borislav Petkov wrote:
> > When forking the child to be traced, we should check the correct return
> > value from fork() and not a local variable which is otherwise unused.
> >
> > Signed-off-by: Borislav Petkov <bp@alien8.de>
> > ---
> > tools/perf/builtin-record.c | 3 +--
> > 1 files changed, 1 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > index 9bc8905..dc3435e 100644
> > --- a/tools/perf/builtin-record.c
> > +++ b/tools/perf/builtin-record.c
> > @@ -503,7 +503,6 @@ static int __cmd_record(int argc, const char **argv)
> > {
> > int i, counter;
> > struct stat st;
> > - pid_t pid = 0;
> > int flags;
> > int err;
> > unsigned long waking = 0;
> > @@ -572,7 +571,7 @@ static int __cmd_record(int argc, const char **argv)
> >
> > if (forks) {
> > child_pid = fork();
> > - if (pid < 0) {
> > + if (child_pid < 0) {
>
>
>
> Oops :)
Yeah, this looked really odd and I had recheck it couple of times just
to be sure I'm not missing any "hidden" semantics. And it seems that
nobody has hit that because obviously we always fork fine :)
--
Regards/Gruss,
Boris.
next prev parent reply other threads:[~2010-05-31 21:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 21:18 Borislav Petkov
2010-05-31 21:27 ` Frederic Weisbecker
2010-05-31 21:40 ` Borislav Petkov [this message]
2010-06-01 7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov
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=20100531214015.GA27050@liondog.tnic \
--to=bp@alien8.de \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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 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®