On Wed, Jun 14, 2023 at 08:32:26AM -0700, Chenyuan Mi wrote: > The pci_get_slot() function may return NULL, which may > cause null pointer deference, and most other callsites of > pci_get_slot() do Null check. Add Null check for return > value of pci_get_slot(). > > Found by our static analysis tool. ... > dma_dev = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0)); > + if (!dma_dev) > + return -ENODEV; This adds (almost) a dead code. The function 0 must be present in accordance with the PCI specification (even earliest version of it state that). If pci_get_slot() returns a NULL, in this case it means that something, much bigger issue, happens and this check won't help us to do anything anyway. -- With Best Regards, Andy Shevchenko