From patchwork Fri May 5 11:57:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 98624 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp81124qge; Fri, 5 May 2017 04:58:08 -0700 (PDT) X-Received: by 10.84.143.129 with SMTP id 1mr64362454plz.105.1493985488144; Fri, 05 May 2017 04:58:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m25si5435892pli.193.2017.05.05.04.58.07; Fri, 05 May 2017 04:58:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753115AbdEEL5w (ORCPT + 6 others); Fri, 5 May 2017 07:57:52 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:65401 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbdEEL5s (ORCPT ); Fri, 5 May 2017 07:57:48 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LkyOr-1df7ne2vRd-00amFk; Fri, 05 May 2017 13:57:35 +0200 From: Arnd Bergmann To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 9/9] [3.18-stable] gfs2: remove IS_ERR_VALUE abuse Date: Fri, 5 May 2017 13:57:25 +0200 Message-Id: <20170505115725.1424772-10-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170505115725.1424772-1-arnd@arndb.de> References: <20170505115725.1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edence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Picked from commit 287980e49ffc0f6d911601e7e352a812ed27768e ("remove lots of IS_ERR_VALUE abuses") upstream. The original fix that was backported to 3.18 already addressed the warning in some configurations, but not in others, leaving us with the same output: ../fs/gfs2/dir.c: In function 'get_first_leaf': ../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized] error = get_leaf(dip, leaf_no, bh_out); ^ ../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20': ../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized] This takes the approach that we took in later versions in mainline, but does not backport the entire patch, as that would be too large for stable and IIRC caused regressions in other drivers. Fixes: 9d46d31e9aea ("gfs2: avoid uninitialized variable warning") Signed-off-by: Arnd Bergmann --- fs/gfs2/dir.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 9291cf5e7439..f3508f4583d5 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -749,12 +749,15 @@ static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out) { __be64 *hash; + int error; hash = gfs2_dir_get_hash_table(dip); - if (IS_ERR(hash)) - return PTR_ERR(hash); - *leaf_out = be64_to_cpu(*(hash + index)); - return 0; + error = PTR_ERR_OR_ZERO(hash); + + if (!error) + *leaf_out = be64_to_cpu(*(hash + index)); + + return error; } static int get_first_leaf(struct gfs2_inode *dip, u32 index, @@ -764,7 +767,7 @@ static int get_first_leaf(struct gfs2_inode *dip, u32 index, int error; error = get_leaf_nr(dip, index, &leaf_no); - if (!IS_ERR_VALUE(error)) + if (!error) error = get_leaf(dip, leaf_no, bh_out); return error; @@ -980,7 +983,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) index = name->hash >> (32 - dip->i_depth); error = get_leaf_nr(dip, index, &leaf_no); - if (IS_ERR_VALUE(error)) + if (error) return error; /* Get the old leaf block */