From patchwork Thu Nov 10 16:44:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9421537 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 04F1560512 for ; Thu, 10 Nov 2016 16:49:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05EDF29504 for ; Thu, 10 Nov 2016 16:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB9A829772; Thu, 10 Nov 2016 16:49:12 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 9A3FE2976F for ; Thu, 10 Nov 2016 16:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935416AbcKJQs6 (ORCPT ); Thu, 10 Nov 2016 11:48:58 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:59577 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964877AbcKJQrq (ORCPT ); Thu, 10 Nov 2016 11:47:46 -0500 Received: from wuerfel.lan ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0LibhV-1cfJpX3E1l-00d1DO; Thu, 10 Nov 2016 17:45:39 +0100 From: Arnd Bergmann To: Linus Torvalds Cc: Andrew Morton , Arnd Bergmann , Anna Schumaker , "David S. Miller" , Herbert Xu , Ilya Dryomov , Javier Martinez Canillas , Jiri Kosina , Jonathan Cameron , Ley Foon Tan , "Luis R . Rodriguez" , Martin Schwidefsky , Mauro Carvalho Chehab , Michal Marek , Russell King , Sean Young , Sebastian Ott , Trond Myklebust , x86@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, nios2-dev@lists.rocketboards.org, linux-s390@vger.kernel.org, linux-crypto@vger.kernel.org, linux-media@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning Date: Thu, 10 Nov 2016 17:44:45 +0100 Message-Id: <20161110164454.293477-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161110164454.293477-1-arnd@arndb.de> References: <20161110164454.293477-1-arnd@arndb.de> X-Provags-ID: V03:K0:uOAwqpBcVOfYCzwvW3UMqvyO8hxpY1KbtblUfXP/jD0IfDiGVd3 rt2KwqdIvEjoFrgxfT5N59tS6DC0qxs3gzxkX7Q2W5tObeB5eLbgbh/7evhnLrvDRpCXMSZ 6crRBIZnHym5Y3GsKi2QUsLgKeZyvcM78wrpbWgR74kChDL142O7s5+Wmg0ZoEOd++ZltQH tXZCxaFGXfWokRo4wZKdg== X-UI-Out-Filterresults: notjunk:1; V01:K0:aQKvq0pBNJE=:wQh9NTDQFTt98popeH5inD V+l1jmG+lXyJgqD2sZg8yJK5qsdhr4A1fzE0KaEfoVnKA5xMS0kKrHsGTrobcydAnimn+aViz /ODYCph3wJcna/VcQO9zQ8f3xsu/PysoZUEDLgTOKGaH02XAZXIpCEL54/ChXLUUUwBFcQPKq cHW8RDug1i/qZDx5w1Jsy0gNZtSbq1cBB2RT6M9cTZfw45tCv8PrStfpE1Iv9xMQ53JBWmcOZ HxdsEnjtFtEd/vl7LW5yuZmBD5oTVaH6cFs5RIF7mP2sWM3pVRMZHuRfeouvR5wFKxGZIAk8u hKSBP0NFLcWpBfk3kG8/RQ4l3/PlCvNtz7/RasjHeTVqPOCl+6dBgw3lO6yUKh8uAEB9sM3YV 4mson6jTtBiMSGo1xIrX6c/hABeowRp8ppEaxtvqj49q45g2eYt9IjlzMN2GOJTAddoJpTvXp 4oVoY6dxf14FD6b4+3Y7utNYQO67WxkLGC4JmlD2zdgity2d0IgWCbpjowjyrG8hGESJXyats 4cdUUU7AOZVew0GuXtXH5lnbTRd4R8mGbfRF/p7LOPu22a16/S+DEsNm0dsQMJT69W8sOzg0f b9fVjYLXGjaLCfE6IPHQ53K1+qBOofP2Wm2qLcwYN2UQMifAcJHxaR4M3UCsJ3exy7iJvUV2Z OMrMAxVfBV+XxWqQJH2z4lDGn4ehiCalqpG0D2BdEfOPlqdC2J0R72rSt39AKm6aKVPY= 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. Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races") Signed-off-by: Arnd Bergmann --- First submitted on Aug 31, but ended up not getting applied then as the warning was disabled in v4.8-rc Anna Schumaker said at the kernel summit that she had applied it and would send it for 4.9, but as of 2016-11-09 it has not made it into linux-next. 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; } /*