From patchwork Mon Oct 17 22:05:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9380715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F1075600CA for ; Mon, 17 Oct 2016 22:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAF4928A86 for ; Mon, 17 Oct 2016 22:08:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF61328C56; Mon, 17 Oct 2016 22:08:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4953A28A86 for ; Mon, 17 Oct 2016 22:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965460AbcJQWH4 (ORCPT ); Mon, 17 Oct 2016 18:07:56 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:52306 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964923AbcJQWHy (ORCPT ); Mon, 17 Oct 2016 18:07:54 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lpis6-1cZSht2k7y-00fWGE; Tue, 18 Oct 2016 00:07:43 +0200 From: Arnd Bergmann To: Trond Myklebust , Anna Schumaker Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , linux-nfs@vger.kernel.org Subject: [PATCH 06/28] NFSv4.1: work around -Wmaybe-uninitialized warning Date: Tue, 18 Oct 2016 00:05:35 +0200 Message-Id: <20161017220557.1688282-6-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:Hd1w6lHYbK5Qh9hcdzn/ja975yZhQqsxv86/G3espoa8M5F2kOf noLjUbxF4W82QpLy+MXNvBxxdAY+TtOV68Lsk21jEI4sqAaYbXGzODqavbge0MFN+id+gQB pno1uQCrqQXJDkroNejQIDFG2GSPET7bCCUHK43avhqXnIwbd2bsn+kMir8FE/Bcl/sqq8R RIfsKANtQfcWQ0/eSRQ8A== X-UI-Out-Filterresults: notjunk:1; V01:K0:7O8HA8pBUO0=:Jcz5cNTv8W9QfvCJQVn8kf P/KV5T2Pnp4iiaN8vNHXJjPt9YtcxBRugZXCVVWI51kSL94CE62/xrS1OwkHxuGaN/MA7zmLP p5JXkczIrv/OTtFTEf1SumFc4RZyEHyvhv5bxb4VsUStTvPEDgccj0bF1mmwRsgrMWyoLXwQw fOP1axnnM0pLzzBoBOTW4L+9yqIRh2KZKFcLXOcRCSMLyiwiE4sgHDPRSeBGfqB60pXroUr7U z+ya8n8FfPGVBxhhcjYCYcz4rK6kW+6EAqdcKHLKtQxovASZqKQY9xfG3QTSr5N6hT2ZJn5GP 2DeqenCluO1MrJeAodUkp6B1G1VOpZvvVEEnvKuwOl1BxgfxYyOtx7vz3++cABLkBNDO4KtIZ 9/ClQiG56Dsy26bpOJP+sEqK1DPSpZ2+4middnx6EXmXEmTUQYKXS4K1M2DFNx+zl9gyQrhm6 0FeZqKrveSTJP7PY+a6ERLKjyU1R+DzzP+B2LahUkMmEriaXW+MHYAib+rzlYF+rNqGb6/r0M YU6+NgAkKaGLE2cZtSri+AUrlu6A2T6O5kYbTe2Cq4np7VCsfancpitys4F/H72TAbcJQeBzV EUVCjkqHN4pdtbmNZhhrQRMn8fncx4bZNxQ/BslJ8aid753kEjiFrOiiREI7dGSATcmijljcG zUF5hKR7R+dZJ3/nY1aoZY+xdVZ20OnYY9Hqe+06oY6TPGw3/8sPkAz5LZg3sj+1FmI8= Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use if we enable -Wmaybe-uninitialized again: fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized] gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair results in a nonzero return value here. Using PTR_ERR_OR_ZERO() instead makes this clear to the compiler. The warning originally did not appear in v4.8 as it was globally disabled, but the bugfix that introduced the warning got backported to stable kernels which again enable it, and this is now the only warning in the v4.7 builds. Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races") Signed-off-by: Arnd Bergmann Cc: Trond Myklebust --- First submitted on Aug 31, but ended up not getting applied then as the warning was disabled in v4.8-rc fs/nfs/nfs4session.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c index b629730..150c5a1 100644 --- a/fs/nfs/nfs4session.c +++ b/fs/nfs/nfs4session.c @@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid, __must_hold(&tbl->slot_tbl_lock) { struct nfs4_slot *slot; + int ret; slot = nfs4_lookup_slot(tbl, slotid); - if (IS_ERR(slot)) - return PTR_ERR(slot); - *seq_nr = slot->seq_nr; - return 0; + ret = PTR_ERR_OR_ZERO(slot); + if (!ret) + *seq_nr = slot->seq_nr; + + return ret; } /*