From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965479AbcJQWH5 (ORCPT ); Mon, 17 Oct 2016 18:07:57 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } /* -- 2.9.0