From patchwork Fri Jun 3 14:50:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 847122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p53Ep6vE021087 for ; Fri, 3 Jun 2011 14:51:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753823Ab1FCOus (ORCPT ); Fri, 3 Jun 2011 10:50:48 -0400 Received: from twin.jikos.cz ([89.185.236.188]:49659 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084Ab1FCOuq (ORCPT ); Fri, 3 Jun 2011 10:50:46 -0400 Received: from twin.jikos.cz (dave@localhost [127.0.0.1]) by twin.jikos.cz (8.13.6/8.13.6) with ESMTP id p53EoFnQ001130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Jun 2011 16:50:15 +0200 Received: (from dave@localhost) by twin.jikos.cz (8.13.6/8.13.6/Submit) id p53EoE4A001129; Fri, 3 Jun 2011 16:50:14 +0200 Date: Fri, 3 Jun 2011 16:50:14 +0200 From: David Sterba To: Stephen Rothwell Cc: Chris Mason , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Miao Xie , David Sterba , Tsutomu Itoh , Itaru Kitayama , linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: fix uninitialized variable warning Message-ID: <20110603145014.GU12709@twin.jikos.cz> Reply-To: dave@jikos.cz Mail-Followup-To: Stephen Rothwell , Chris Mason , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Miao Xie , David Sterba , Tsutomu Itoh , Itaru Kitayama , linux-btrfs@vger.kernel.org References: <20110603110011.77121203.sfr@canb.auug.org.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110603110011.77121203.sfr@canb.auug.org.au> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Jun 2011 14:51:07 +0000 (UTC) From: David Sterba With Linus' tree, today's linux-next build (powercp ppc64_defconfig) produced this warning: fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode': fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used uninitialized in this function Introduced by commit 16cdcec736cd ("btrfs: implement delayed inode items operation"). This fixes a bug in btrfs_update_inode(): if the returned value from btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not updated and several call paths may hit a BUG_ON or fail with strange code. Reported-by: Stephen Rothwell Signed-off-by: David Sterba --- patch pushed to git://repo.or.cz/linux-2.6/btrfs-unstable.git #fixes fs/btrfs/delayed-inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 01e2950..8cb012f 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1595,7 +1595,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode) { struct btrfs_delayed_node *delayed_node; - int ret; + int ret = 0; delayed_node = btrfs_get_or_create_delayed_node(inode); if (IS_ERR(delayed_node))