NFSv4: Fixup smatch warning for ambiguous return
authorBenjamin Coddington <bcodding@redhat.com>
Wed, 17 Apr 2024 18:49:29 +0000 (14:49 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 20 May 2024 15:12:59 +0000 (11:12 -0400)
commit37ffe06537af3e3ec212e7cbe941046fce0a822f
treebbf1f423114b7f6096db9292b122eb90afaec9cf
parentbf95f82e6a569f41bae1e37204b219a5e1e8b971
NFSv4: Fixup smatch warning for ambiguous return

Dan Carpenter reports smatch warning for nfs4_try_migration() when a memory
allocation failure results in a zero return value.  In this case, a
transient allocation failure error will likely be retried the next time the
server responds with NFS4ERR_MOVED.

We can fixup the smatch warning with a small refactor: attempt all three
allocations before testing and returning on a failure.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: c3ed222745d9 ("NFSv4: Fix free of uninitialized nfs4_label on referral lookup.")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4state.c