Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174803
b: refs/heads/master
c: e823d6f
h: refs/heads/master
i:
  174801: 74a576e
  174799: 8b12a00
v: v3
  • Loading branch information
Bjorn Helgaas authored and Jesse Barnes committed Nov 24, 2009
1 parent a3f1955 commit 6c9b0a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5663b1b963183e98ece3e77e471da833bb5ad2ff
refs/heads/master: e823d6ff581c5d1d76aa8c73a202d7d1419d34b8
12 changes: 7 additions & 5 deletions trunk/arch/x86/pci/mmconfig-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
{
struct acpi_table_mcfg *mcfg;
unsigned long i;
int config_size;
int entries, config_size;

if (!header)
return -EINVAL;
Expand All @@ -564,17 +564,18 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)

/* how many config structures do we have */
pci_mmcfg_config_num = 0;
entries = 0;
i = header->length - sizeof(struct acpi_table_mcfg);
while (i >= sizeof(struct acpi_mcfg_allocation)) {
++pci_mmcfg_config_num;
entries++;
i -= sizeof(struct acpi_mcfg_allocation);
};
if (pci_mmcfg_config_num == 0) {
if (entries == 0) {
printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
return -ENODEV;
}

config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
config_size = entries * sizeof(*pci_mmcfg_config);
pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
if (!pci_mmcfg_config) {
printk(KERN_WARNING PREFIX
Expand All @@ -583,8 +584,9 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
}

memcpy(pci_mmcfg_config, &mcfg[1], config_size);
pci_mmcfg_config_num = entries;

for (i = 0; i < pci_mmcfg_config_num; ++i) {
for (i = 0; i < entries; i++) {
if (acpi_mcfg_check_entry(mcfg, &pci_mmcfg_config[i])) {
kfree(pci_mmcfg_config);
pci_mmcfg_config_num = 0;
Expand Down

0 comments on commit 6c9b0a2

Please sign in to comment.