mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
powerpc/powernv/sriov: perform null check on iov before dereferencing iov
[ Upstream commitf4f913c980
] 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:052da31d45
("powerpc/powernv/sriov: De-indent setup and teardown") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230608095849.1147969-1-colin.i.king@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
46b7dd46f5
commit
932d3f58a9
1 changed files with 3 additions and 3 deletions
|
@ -600,12 +600,12 @@ static void pnv_pci_sriov_disable(struct pci_dev *pdev)
|
|||
struct pnv_iov_data *iov;
|
||||
|
||||
iov = pnv_iov_get(pdev);
|
||||
num_vfs = iov->num_vfs;
|
||||
base_pe = iov->vf_pe_arr[0].pe_number;
|
||||
|
||||
if (WARN_ON(!iov))
|
||||
return;
|
||||
|
||||
num_vfs = iov->num_vfs;
|
||||
base_pe = iov->vf_pe_arr[0].pe_number;
|
||||
|
||||
/* Release VF PEs */
|
||||
pnv_ioda_release_vf_PE(pdev);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue