Commit 6314465b authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

powerpc/powernv/sriov: perform null check on iov before dereferencing iov



[ Upstream commit f4f913c9 ]

Currently pointer iov is being dereferenced before the null check of iov
which can lead to null pointer dereference errors. Fix this by moving the
iov null check before the dereferencing.

Detected using cppcheck static analysis:
linux/arch/powerpc/platforms/powernv/pci-sriov.c:597:12: warning: Either
the condition '!iov' is redundant or there is possible null pointer
dereference: iov. [nullPointerRedundantCheck]
 num_vfs = iov->num_vfs;
           ^

Fixes: 052da31d ("powerpc/powernv/sriov: De-indent setup and teardown")
Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230608095849.1147969-1-colin.i.king@gmail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent accac779
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment