From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753751Ab0EaV12 (ORCPT ); Mon, 31 May 2010 17:27:28 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:49313 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753434Ab0EaV11 (ORCPT ); Mon, 31 May 2010 17:27:27 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Sr/Dez7ygDJ6GWLX8NjWV5tuZHV7yUr98gxrXFjCZSGv483/W3ySzkI+epYvhnp/Am NIKOfRSxq65JcZyJAnGadkwLcAeNlrVi3LuJw+ieQcpKeoFBf3mmo/OGV6DgdbcmcPZ8 Fx0E2mCRlgaH+IzFPHBMwEDk505EV+TnyuM1Q= Date: Mon, 31 May 2010 23:27:26 +0200 From: Frederic Weisbecker To: Borislav Petkov Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , LKML Subject: Re: [PATCH] perf-record: Check correct pid when forking Message-ID: <20100531212723.GH5157@nowhere> References: <20100531211818.GA30175@liondog.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100531211818.GA30175@liondog.tnic> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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.