]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFSv4: Fixup smatch warning for ambiguous return
authorBenjamin Coddington <bcodding@redhat.com>
Wed, 17 Apr 2024 18:49:29 +0000 (14:49 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:46 +0000 (13:39 +0200)
commit61ceeebbd2a08b7467c440ef4b7063e171d5c418
treec75886968787db0842b019a52de9ad88f19fa44b
parent1c03ea9acb14c444cc62773425ef4e6c94053ef9
NFSv4: Fixup smatch warning for ambiguous return

[ Upstream commit 37ffe06537af3e3ec212e7cbe941046fce0a822f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4state.c