From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760566AbZE0G4L (ORCPT ); Wed, 27 May 2009 02:56:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758946AbZE0Gz7 (ORCPT ); Wed, 27 May 2009 02:55:59 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:51164 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758350AbZE0Gz6 (ORCPT ); Wed, 27 May 2009 02:55:58 -0400 Date: Tue, 26 May 2009 23:54:42 -0700 From: Andrew Morton To: Jaswinder Singh Rajput Cc: Ingo Molnar , Balbir Singh , Randy Dunlap , x86 maintainers , LKML Subject: Re: [PATCH -tip] Documentation/accounting/getdelays.c intialize the variable before using it Message-Id: <20090526235442.d793ac89.akpm@linux-foundation.org> In-Reply-To: <1242796484.3260.12.camel@localhost.localdomain> References: <1242796484.3260.12.camel@localhost.localdomain> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 May 2009 10:44:44 +0530 Jaswinder Singh Rajput wrote: > > May be in some cases cmd_type will be used uninitialized. > > Also fixes compilation warning: > > CC [M] Documentation/DocBook/procfs_example.o > Documentation/accounting/getdelays.c: In function ___main___: > Documentation/accounting/getdelays.c:249: warning: ___cmd_type___ may be used uninitialized in this function > > Signed-off-by: Jaswinder Singh Rajput > --- > Documentation/accounting/getdelays.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c > index 7ea2311..36aae3b 100644 > --- a/Documentation/accounting/getdelays.c > +++ b/Documentation/accounting/getdelays.c > @@ -246,7 +246,7 @@ void print_ioacct(struct taskstats *t) > > int main(int argc, char *argv[]) > { > - int c, rc, rep_len, aggr_len, len2, cmd_type; > + int c, rc, rep_len, aggr_len, len2, cmd_type = TASKSTATS_CMD_ATTR_UNSPEC; > __u16 id; > __u32 mypid; > >>From my reading of the code there is no bug here - we'll only use cmd_type if tid != 0, and cmd_type is always initialised when tid != 0. But I suppose we should squish the warning anyway. btw, whichever version of gcc you're using has apparently regressed - my gcc-4.3.0 manages to work out what's happening. Hence please prefer to include the gcc version in the changelog. And send a bug report at the gcc guys if appropriate ;)