Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e84efa32 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds
Browse files

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.

Fixes: e09c978a ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a76bcf55
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid,
	__must_hold(&tbl->slot_tbl_lock)
	__must_hold(&tbl->slot_tbl_lock)
{
{
	struct nfs4_slot *slot;
	struct nfs4_slot *slot;
	int ret;


	slot = nfs4_lookup_slot(tbl, slotid);
	slot = nfs4_lookup_slot(tbl, slotid);
	if (IS_ERR(slot))
	ret = PTR_ERR_OR_ZERO(slot);
		return PTR_ERR(slot);
	if (!ret)
		*seq_nr = slot->seq_nr;
		*seq_nr = slot->seq_nr;
	return 0;

	return ret;
}
}


/*
/*