aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-10-17 18:05:35 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-10-24 13:54:43 -0400
commit68a564006a21ae59c7c51b4359e2e8efa42ae4af (patch)
treeb58288358e24fceb42f0b45b962b0a356870ce8f
parent86a6c211d676add579a75b7e172a72bb3e2c21f8 (diff)
NFSv4.1: work around -Wmaybe-uninitialized warning
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. The warning originally did not appear in v4.8 as it was globally disabled, but the bugfix that introduced the warning got backported to stable kernels which again enable it, and this is now the only warning in the v4.7 builds. Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/nfs4session.c10
1 files changed, 6 insertions, 4 deletions
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,
178 __must_hold(&tbl->slot_tbl_lock) 178 __must_hold(&tbl->slot_tbl_lock)
179{ 179{
180 struct nfs4_slot *slot; 180 struct nfs4_slot *slot;
181 int ret;
181 182
182 slot = nfs4_lookup_slot(tbl, slotid); 183 slot = nfs4_lookup_slot(tbl, slotid);
183 if (IS_ERR(slot)) 184 ret = PTR_ERR_OR_ZERO(slot);
184 return PTR_ERR(slot); 185 if (!ret)
185 *seq_nr = slot->seq_nr; 186 *seq_nr = slot->seq_nr;
186 return 0; 187
188 return ret;
187} 189}
188 190
189/* 191/*