Showing error 1834

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/pcmcia/pcmcia_ioctl.c
Line in file: 572
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

 542
 543                bus = pcmcia_lookup_bus(s);
 544                if (bus) {
 545                        struct list_head *list;
 546                        struct pci_dev *dev = NULL;
 547
 548                        list = bus->devices.next;
 549                        while (list != &bus->devices) {
 550                                struct pci_dev *pdev = pci_dev_b(list);
 551                                list = list->next;
 552
 553                                if (first) {
 554                                        dev = pdev;
 555                                        break;
 556                                }
 557
 558                                /* Try to handle "next" here some way? */
 559                        }
 560                        if (dev && dev->driver) {
 561                                strlcpy(bind_info->name, dev->driver->name, DEV_NAME_LEN);
 562                                bind_info->major = 0;
 563                                bind_info->minor = 0;
 564                                bind_info->next = NULL;
 565                                return 0;
 566                        }
 567                }
 568        }
 569#endif
 570
 571        spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
 572        list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
 573                if (p_dev->func == bind_info->function) {
 574                        p_dev = pcmcia_get_dev(p_dev);
 575                        if (!p_dev)
 576                                continue;
 577                        goto found;
 578                }
 579        }
 580        spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
 581        return -ENODEV;
 582
Show full sources