i7core_edac: properly terminate pci_dev_table
At pci_xeon_fixup(), it waits for a null-terminated table, while at i7core_get_all_devices, it just do a for 0..ARRAY_SIZE. As other tables are zero-terminated, change it to be terminate with 0 as well, and fixes a bug where it may be running out of the table elements. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
a3e1541637
commit
3c52cc57cc
|
@ -353,6 +353,7 @@ static const struct pci_id_table pci_dev_table[] = {
|
||||||
PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_nehalem),
|
PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_nehalem),
|
||||||
PCI_ID_TABLE_ENTRY(pci_dev_descr_lynnfield),
|
PCI_ID_TABLE_ENTRY(pci_dev_descr_lynnfield),
|
||||||
PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_westmere),
|
PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_westmere),
|
||||||
|
{0,} /* 0 terminated list. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1409,14 +1410,13 @@ static int i7core_get_onedevice(struct pci_dev **prev,
|
||||||
|
|
||||||
static int i7core_get_all_devices(void)
|
static int i7core_get_all_devices(void)
|
||||||
{
|
{
|
||||||
int i, j, rc, last_bus;
|
int i, rc, last_bus;
|
||||||
struct pci_dev *pdev = NULL;
|
struct pci_dev *pdev = NULL;
|
||||||
const struct pci_id_table *table;
|
const struct pci_id_table *table = pci_dev_table;
|
||||||
|
|
||||||
last_bus = i7core_pci_lastbus();
|
last_bus = i7core_pci_lastbus();
|
||||||
|
|
||||||
for (j = 0; j < ARRAY_SIZE(pci_dev_table); j++) {
|
while (table && table->descr) {
|
||||||
table = &pci_dev_table[j];
|
|
||||||
for (i = 0; i < table->n_devs; i++) {
|
for (i = 0; i < table->n_devs; i++) {
|
||||||
pdev = NULL;
|
pdev = NULL;
|
||||||
do {
|
do {
|
||||||
|
@ -1432,6 +1432,7 @@ static int i7core_get_all_devices(void)
|
||||||
}
|
}
|
||||||
} while (pdev);
|
} while (pdev);
|
||||||
}
|
}
|
||||||
|
table++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue