PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish()
Subsystems (2)
Logan Gunthorpe
maintainerPATCH 1/1 PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish()
We should only assign 'p2pmem_published' if 'pdev->p2pdma' is not NULL. The extra check on 'publish' makes no sense.
Signed-off-by Logan Gunthorpe <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Christoph Hellwig <[email protected]>
--- drivers/pci/p2pdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/p2pdma.c +2 -4
@@ -678,10 +678,8 @@ EXPORT_SYMBOL_GPL(pci_p2pmem_free_sgl);*/ void pci_p2pmem_publish (struct pci_dev *pdev,bool publish) { -if (publish && !pdev->p2pdma) -return ; - - pdev->p2pdma->p2pmem_published = publish; +if (pdev->p2pdma) + pdev->p2pdma->p2pmem_published = publish; }EXPORT_SYMBOL_GPL (pci_p2pmem_publish);
Signature · 1 line
2.19.0
Quoted 7 lines · Logan Gunthorpe
We should only assign '
p2pmem_published' if 'pdev->p2pdma' is not NULL. The extra check on 'publish' makes no sense.Signed-off-by Logan Gunthorpe <[email protected]>Reported-by Dan Carpenter <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Christoph Hellwig <[email protected]>
I folded this into the original commit on pci/peer-to-peer, thanks!
Quoted 24 lines
--- drivers/pci/p2pdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/pci/p2pdma.c +2
-4@@ -678,10 +678,8 @@ EXPORT_SYMBOL_GPL(pci_p2pmem_free_sgl);*/ void pci_p2pmem_publish (struct pci_dev *pdev,bool publish) { -if (publish && !pdev->p2pdma) -return ; - - pdev->p2pdma->p2pmem_published = publish; +if (pdev->p2pdma) + pdev->p2pdma->p2pmem_published = publish; }EXPORT_SYMBOL_GPL (pci_p2pmem_publish);Signature · 1 line
2.19.0