pci: fix off-by-one error and introduce MAX_PCI_FUNC
authorSebastian Herbszt <herbszt@gmx.de>
Wed, 11 Jun 2008 20:53:01 +0000 (22:53 +0200)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 13 Jun 2008 16:19:57 +0000 (09:19 -0700)
commiteab6f0763744c964eded45b48ec41cb6c1f65cdb
tree49d2c82074cc796ecede0e0e682751b715343caf
parent2c1e6e2be80c54fcf36f89e9de9ab1a5fba5df87
pci: fix off-by-one error and introduce MAX_PCI_FUNC

In include/sys/pci.h we have

#define MAX_PCI_BUSES 255

and

struct pci_bus_list {
        struct pci_bus pci_bus[MAX_PCI_BUSES];
        uint8_t count;
};

And in lib/pci/scan.c

for (bus = 0; bus <= MAX_PCI_BUSES; bus++) {

    pci_bus_list->pci_bus[bus].pci_device_count = 0;

Fix possible overflows and introduce MAX_PCI_FUNC.

- Sebastian
com32/include/sys/pci.h
com32/lib/pci/scan.c