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: 693341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tF89S1nTsz9vDh for ; Fri, 11 Nov 2016 03:47:40 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c4sVm-0004Dc-JG; Thu, 10 Nov 2016 16:47:38 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c4sVi-0003xI-1a for linux-snps-arc@lists.infradead.org; Thu, 10 Nov 2016 16:47:35 +0000 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 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161110_084734_487939_47150B22 X-CRM114-Status: GOOD ( 12.95 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.131 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.131 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Young , Trond Myklebust , linux-s390@vger.kernel.org, Herbert Xu , x86@kernel.org, Sebastian Ott , Russell King , Javier Martinez Canillas , Ilya Dryomov , linux-snps-arc@lists.infradead.org, linux-media@vger.kernel.org, Arnd Bergmann , linux-kbuild@vger.kernel.org, Jiri Kosina , Michal Marek , nios2-dev@lists.rocketboards.org, Mauro Carvalho Chehab , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Anna Schumaker , "Luis R . Rodriguez" , linux-crypto@vger.kernel.org, Martin Schwidefsky , Ley Foon Tan , Andrew Morton , "David S. Miller" , Jonathan Cameron MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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. 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; } /*