Skip to contentSkip to conversation

PCI: endpoint: Assign PCI domain number for endpoint controllers

bug report Dan Carpenter 1 participant 1 message Sep 5, 2024 PCI

lore
Share & tools
lore
#0 lore raw

Hello Manivannan Sadhasivam,

Commit 0328947c5032 ("PCI: endpoint: Assign PCI domain number for endpoint controllers") from Aug 28, 2024 (linux-next), leads to the following Smatch static checker warning:

	drivers/pci/endpoint/pci-epc-core.c:843 pci_epc_destroy()
	error: NULL dereference inside function 'pci_bus_release_domain_nr((0), &epc->dev)()'

drivers/pci/endpoint/pci-epc-core.c

    833  * @epc: the EPC device that has to be destroyed
    834  *
    835  * Invoke to destroy the PCI EPC device
    836  */
    837 void pci_epc_destroy(struct pci_epc *epc)
    838 {
    839         pci_ep_cfs_remove_epc_group(epc->group);
    840         device_unregister(&epc->dev);
    841 
    842 #ifdef CONFIG_PCI_DOMAINS_GENERIC
--> 843         pci_bus_release_domain_nr(NULL, &epc->dev);
                                          ^^^^

Passing a NULL "bus" pointer doesn't make sense. If acpi is disabled then it won't do anything, but otherwise it will Oops.

    844 #endif
    845 }

regards,
dan carpenter