* [PATCH] perf-record: Check correct pid when forking
@ 2010-05-31 21:18 Borislav Petkov
2010-05-31 21:27 ` Frederic Weisbecker
2010-06-01 7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov
0 siblings, 2 replies; 4+ messages in thread
From: Borislav Petkov @ 2010-05-31 21:18 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Peter Zijlstra, Ingo Molnar, lkml
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) {
perror("failed to fork");
exit(-1);
}
--
1.7.1
--
Regards/Gruss,
Boris.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf-record: Check correct pid when forking
2010-05-31 21:18 [PATCH] perf-record: Check correct pid when forking Borislav Petkov
@ 2010-05-31 21:27 ` Frederic Weisbecker
2010-05-31 21:40 ` Borislav Petkov
2010-06-01 7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov
1 sibling, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2010-05-31 21:27 UTC (permalink / raw)
To: Borislav Petkov
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, LKML
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 :)
Since I'm preparing some fixes for .35 in perf tools, I'm queuing this one
too.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf-record: Check correct pid when forking
2010-05-31 21:27 ` Frederic Weisbecker
@ 2010-05-31 21:40 ` Borislav Petkov
0 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2010-05-31 21:40 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, LKML
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/urgent] perf-record: Check correct pid when forking
2010-05-31 21:18 [PATCH] perf-record: Check correct pid when forking Borislav Petkov
2010-05-31 21:27 ` Frederic Weisbecker
@ 2010-06-01 7:04 ` tip-bot for Borislav Petkov
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Borislav Petkov @ 2010-06-01 7:04 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
a.p.zijlstra, bp, fweisbec, tglx, mingo
Commit-ID: 2fb750e825b5347de0390315f4284f13709a9856
Gitweb: http://git.kernel.org/tip/2fb750e825b5347de0390315f4284f13709a9856
Author: Borislav Petkov <bp@alien8.de>
AuthorDate: Mon, 31 May 2010 23:18:18 +0200
Committer: Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Tue, 1 Jun 2010 00:57:14 +0200
perf-record: Check correct pid when forking
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>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100531211818.GA30175@liondog.tnic>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
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) {
perror("failed to fork");
exit(-1);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-01 7:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 21:18 [PATCH] perf-record: Check correct pid when forking Borislav Petkov
2010-05-31 21:27 ` Frederic Weisbecker
2010-05-31 21:40 ` Borislav Petkov
2010-06-01 7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov
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.