From patchwork Wed Aug 31 12:39:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9307119 X-Patchwork-Delegate: Trond.Myklebust@netapp.com 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 43DD660756 for ; Wed, 31 Aug 2016 12:39:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C04228F1A for ; Wed, 31 Aug 2016 12:39:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10A9528F1F; Wed, 31 Aug 2016 12:39:19 +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=-5.9 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 6DACB28F1A for ; Wed, 31 Aug 2016 12:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933723AbcHaMjR (ORCPT ); Wed, 31 Aug 2016 08:39:17 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50901 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932687AbcHaMjQ (ORCPT ); Wed, 31 Aug 2016 08:39:16 -0400 Received: from wuerfel.lan. ([176.7.54.107]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0MWvfk-1bZYSr1cOK-00Vxg4; Wed, 31 Aug 2016 14:39:05 +0200 From: Arnd Bergmann To: Trond Myklebust , Anna Schumaker Cc: netdev@vger.kernel.org, Arnd Bergmann , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Date: Wed, 31 Aug 2016 14:39:01 +0200 Message-Id: <20160831123911.3467676-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:WubVW5t1AcgB9y3U3dvfEEz+Yel2MFmDIRBsLASCKv7JyYmVk+V UElRmuoy3iiAIMzmEGKWoq9KDo2ORatIDXMFuAIg6B1EyClwEWUNFCc8rBfrFgXdvzh3hg7 /cUZ1zK9lTHriARwMMBvAp8Dem6/KOpZ6z40lPHzPYypwtZ5eurg3+hVLT/eYt2+EOSjjIg f7Nf1EKQnmhaXXNA90j9g== X-UI-Out-Filterresults: notjunk:1; V01:K0:gVuk7gPLAm4=:TVWVgLKL5GWJBjUk2A76ez PA+4sEl1iYy1m5MPjq+b2TozgwAAFGrMSegXr8OaSClJ509350l0nDhtmA7mYSmrdA0IiKVOw NVbNo469pAb893M+cZGBEw6cJ8xYeFXCpLSiwRZ4sUjlZ7V2+k5jRZL8ZdhzKNl9hZ10KiCPr qS5RX2dBxqSDmxBfv9oQIRiUp/FeDL1VDA1lh9yimGJ/NtlIbW2mv8OCbRVps2vRLVrLThw7A syZbBnWkqQUtplRBVxCb+uL59qPpe2FxKYzbAsYVBbCkUt/B4h9XvJEdHR9QmqDIbHoBVbQMo drfvy3E9YnH8z2qh/sCBoHlnmlludN43vH39c9KadjEe4AOMOmeED1veDzfzT7NitlBJfV7B+ rSjjiAc1H6n1UbQ7ndBAyCmhkKSVvn8FE8s1m3MNxvYX1PDgZnmMP6IO1rspnUEMHllxjPGc3 coEecVz5JTbEcBnMuoiQIee/KEibdcuzL2tj/FFxos0iO9L5VaGlawxE+tNXH9CfLslP39ib5 iT3DZRGCBbFYrJLMNhRNBigYWsjzWrcp4LJs7F86zeesP/sVu5DWhc6JLN6JA0Ey9unYFggzI 8bzeV0hUaw1Ss2NGDvpS7NnQdwNNZNWPtgL02jK95kSNy9OubuJ0JRRGcZmYTsXBmDYVv/w4e rmDAXBiPaGROGxscZwa1erOyxHbdbK+SuydAlU6S7lN2FphO0+hYtCCm/GidX9kBJjHo= 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: 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. Signed-off-by: Arnd Bergmann Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races") --- fs/nfs/nfs4session.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) The patch that caused this just came in for v4.8-rc5. As the warning is now disabled by default and this is harmless, this can probably get queued for v4.9 instead. I mentioned earlier that I got the new warning for net-next, but failed to notice that it had come from mainline instead. diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c index b62973045a3e..150c5a1879bf 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; } /*