From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759680AbcHaNR6 (ORCPT ); Wed, 31 Aug 2016 09:17:58 -0400 Received: from us-smtp-delivery-194.mimecast.com ([63.128.21.194]:34201 "EHLO us-smtp-delivery-194.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759677AbcHaNR4 (ORCPT ); Wed, 31 Aug 2016 09:17:56 -0400 From: Trond Myklebust To: Arnd Bergmann CC: Schumaker Anna , "List Linux Network Devel Mailing" , List Linux NFS Mailing , List Linux Kernel Mailing Subject: Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Thread-Topic: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Thread-Index: AQHSA4StdwGC8028SUiPzNzQJCnXO6BjDRqA Date: Wed, 31 Aug 2016 13:17:48 +0000 Message-ID: <9F99A562-A4F6-457A-A78F-44BAC3B5734F@primarydata.com> References: <20160831123911.3467676-1-arnd@arndb.de> In-Reply-To: <20160831123911.3467676-1-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [68.49.162.121] x-ms-office365-filtering-correlation-id: 30129462-d49b-457b-c106-08d3d1a13476 x-microsoft-exchange-diagnostics: 1;DM5PR11MB1898;20:lIouDqlOd/VK70/8N/5e/e+0fSpwSE9xkUOt4Sj3GfO61U5I0ZYcIS13vcldfKLXUJFj4GktWe92S1wY0Ib+tYK9f5n1bALG6QIFsSlQ2d0h/k89jlHP6m5If8g40k/WjMBOAX577FE9V6/7oqUOGy7B4DCi0bV3Q3Obeq6j4Mc= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1898; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6043046)(6042046);SRVR:DM5PR11MB1898;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1898; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(199003)(189002)(24454002)(3280700002)(3660700001)(54356999)(76176999)(33656002)(101416001)(106116001)(99286002)(50986999)(105586002)(2906002)(36756003)(4326007)(7736002)(7846002)(305945005)(122556002)(83716003)(11100500001)(19580405001)(86362001)(82746002)(3846002)(102836003)(6116002)(10400500002)(87936001)(2950100001)(5002640100001)(2900100001)(189998001)(66066001)(77096005)(68736007)(92566002)(110136002)(8936002)(81156014)(81166006)(106356001)(8676002)(97736004)(5660300001)(19580395003)(586003)(104396002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR11MB1898;H:DM5PR11MB1899.namprd11.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: primarydata.com X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2016 13:17:48.6957 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 03193ed6-8726-4bb3-a832-18ab0d28adb7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1898 X-MC-Unique: q8OQyOduNJGuUN8SiuRlkQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u7VDI4td004590 > On Aug 31, 2016, at 08:39, Arnd Bergmann wrote: > > 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; > } > What version of gcc are you using? I’m unable to reproduce with gcc 6.1.1..