diff options
| author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-24 09:12:28 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-24 09:31:50 -0400 |
| commit | 3c52cc57ccd5c99441368d5e66be36681ce90e72 (patch) | |
| tree | 1530857d511404da725e56e0943b6b722f84907e | |
| parent | a3e1541637f2096ab31af311c53eaeb0853650d3 (diff) | |
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>
| -rw-r--r-- | drivers/edac/i7core_edac.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 71f4dc699ab..e3404b2bbaa 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
| @@ -353,6 +353,7 @@ static const struct pci_id_table pci_dev_table[] = { | |||
| 353 | PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_nehalem), | 353 | PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_nehalem), |
| 354 | PCI_ID_TABLE_ENTRY(pci_dev_descr_lynnfield), | 354 | PCI_ID_TABLE_ENTRY(pci_dev_descr_lynnfield), |
| 355 | PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_westmere), | 355 | PCI_ID_TABLE_ENTRY(pci_dev_descr_i7core_westmere), |
| 356 | {0,} /* 0 terminated list. */ | ||
| 356 | }; | 357 | }; |
| 357 | 358 | ||
| 358 | /* | 359 | /* |
| @@ -1409,14 +1410,13 @@ static int i7core_get_onedevice(struct pci_dev **prev, | |||
| 1409 | 1410 | ||
| 1410 | static int i7core_get_all_devices(void) | 1411 | static int i7core_get_all_devices(void) |
| 1411 | { | 1412 | { |
| 1412 | int i, j, rc, last_bus; | 1413 | int i, rc, last_bus; |
| 1413 | struct pci_dev *pdev = NULL; | 1414 | struct pci_dev *pdev = NULL; |
| 1414 | const struct pci_id_table *table; | 1415 | const struct pci_id_table *table = pci_dev_table; |
| 1415 | 1416 | ||
| 1416 | last_bus = i7core_pci_lastbus(); | 1417 | last_bus = i7core_pci_lastbus(); |
| 1417 | 1418 | ||
| 1418 | for (j = 0; j < ARRAY_SIZE(pci_dev_table); j++) { | 1419 | while (table && table->descr) { |
| 1419 | table = &pci_dev_table[j]; | ||
| 1420 | for (i = 0; i < table->n_devs; i++) { | 1420 | for (i = 0; i < table->n_devs; i++) { |
| 1421 | pdev = NULL; | 1421 | pdev = NULL; |
| 1422 | do { | 1422 | do { |
| @@ -1432,6 +1432,7 @@ static int i7core_get_all_devices(void) | |||
| 1432 | } | 1432 | } |
| 1433 | } while (pdev); | 1433 | } while (pdev); |
| 1434 | } | 1434 | } |
| 1435 | table++; | ||
| 1435 | } | 1436 | } |
| 1436 | 1437 | ||
| 1437 | return 0; | 1438 | return 0; |
