Showing error 1647

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/pci/hotplug/pci_hotplug_core.c
Line in file: 584
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

554int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
555                        const char *name)
556{
557        int result;
558        struct pci_slot *pci_slot;
559
560        if (slot == NULL)
561                return -ENODEV;
562        if ((slot->info == NULL) || (slot->ops == NULL))
563                return -EINVAL;
564        if (slot->release == NULL) {
565                dbg("Why are you trying to register a hotplug slot "
566                    "without a proper release function?\n");
567                return -EINVAL;
568        }
569
570        mutex_lock(&pci_hp_mutex);
571
572        /*
573         * No problems if we call this interface from both ACPI_PCI_SLOT
574         * driver and call it here again. If we've already created the
575         * pci_slot, the interface will simply bump the refcount.
576         */
577        pci_slot = pci_create_slot(bus, slot_nr, name, slot);
578        if (IS_ERR(pci_slot)) {
579                result = PTR_ERR(pci_slot);
580                goto out;
581        }
582
583        slot->pci_slot = pci_slot;
584        pci_slot->hotplug = slot;
585
586        list_add(&slot->slot_list, &pci_hotplug_slot_list);
587
588        result = fs_add_slot(pci_slot);
589        kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
590        dbg("Added slot %s to the list\n", name);
591out:
592        mutex_unlock(&pci_hp_mutex);
593        return result;
594}
Show full sources