Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1473450

Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning

From Trond Myklebust <trondmy@primarydata.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning
Date 2016-08-31 15:20 +0200
Message-ID <scdAR-2Rr-7@gated-at.bofh.it> (permalink)
References <sccYa-2pg-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On Aug 31, 2016, at 08:39, Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> 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..

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-08-31 14:40 +0200
  [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released Arnd Bergmann <arnd@arndb.de> - 2016-08-31 14:40 +0200
    Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released David Howells <dhowells@redhat.com> - 2016-08-31 19:40 +0200
      Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released Arnd Bergmann <arnd@arndb.de> - 2016-08-31 21:50 +0200
    Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released David Howells <dhowells@redhat.com> - 2016-08-31 22:30 +0200
      Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released Arnd Bergmann <arnd@arndb.de> - 2016-08-31 22:40 +0200
        Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released David Howells <dhowells@redhat.com> - 2016-08-31 23:10 +0200
    Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released David Howells <dhowells@redhat.com> - 2016-08-31 22:30 +0200
      Re: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released Arnd Bergmann <arnd@arndb.de> - 2016-08-31 22:40 +0200
      Re: [PATCH 2/2] rxrpc: fix undefined behavior in  rxrpc_mark_call_released David Miller <davem@davemloft.net> - 2016-08-31 23:00 +0200
  Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Trond Myklebust <trondmy@primarydata.com> - 2016-08-31 15:20 +0200
    Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-08-31 15:40 +0200
      Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Trond Myklebust <trondmy@primarydata.com> - 2016-08-31 17:10 +0200
        Re: [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-08-31 18:00 +0200

csiph-web