提交 f7ca6984 编写于 作者: B Bjorn Helgaas 提交者: Jesse Barnes

x86/PCI: MMCONFIG: reject MMCONFIG apertures at address zero

Since all MMCONFIG regions go through pci_mmconfig_add(), we can test the
address once there.  If the caller supplies an address of zero, we never
insert it in the pci_mmcfg_config[] table, so no need to test it elsewhere.
Reviewed-by: NYinghai Lu <yinghai@kernel.org>
Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 463a5df1
...@@ -41,6 +41,9 @@ static __init struct acpi_mcfg_allocation *pci_mmconfig_add(int segment, ...@@ -41,6 +41,9 @@ static __init struct acpi_mcfg_allocation *pci_mmconfig_add(int segment,
int new_num = pci_mmcfg_config_num + 1; int new_num = pci_mmcfg_config_num + 1;
int i = pci_mmcfg_config_num; int i = pci_mmcfg_config_num;
if (addr == 0)
return NULL;
new = kzalloc(sizeof(pci_mmcfg_config[0]) * new_num, GFP_KERNEL); new = kzalloc(sizeof(pci_mmcfg_config[0]) * new_num, GFP_KERNEL);
if (!new) if (!new)
return NULL; return NULL;
...@@ -471,8 +474,7 @@ static void __init pci_mmcfg_reject_broken(int early) ...@@ -471,8 +474,7 @@ static void __init pci_mmcfg_reject_broken(int early)
typeof(pci_mmcfg_config[0]) *cfg; typeof(pci_mmcfg_config[0]) *cfg;
int i; int i;
if ((pci_mmcfg_config_num == 0) || if (pci_mmcfg_config_num == 0)
(pci_mmcfg_config[0].address == 0))
return; return;
for (i = 0; i < pci_mmcfg_config_num; i++) { for (i = 0; i < pci_mmcfg_config_num; i++) {
...@@ -616,8 +618,7 @@ static void __init __pci_mmcfg_init(int early) ...@@ -616,8 +618,7 @@ static void __init __pci_mmcfg_init(int early)
pci_mmcfg_reject_broken(early); pci_mmcfg_reject_broken(early);
if ((pci_mmcfg_config_num == 0) || if (pci_mmcfg_config_num == 0)
(pci_mmcfg_config[0].address == 0))
return; return;
if (pci_mmcfg_arch_init()) if (pci_mmcfg_arch_init())
...@@ -649,8 +650,7 @@ static int __init pci_mmcfg_late_insert_resources(void) ...@@ -649,8 +650,7 @@ static int __init pci_mmcfg_late_insert_resources(void)
*/ */
if ((pci_mmcfg_resources_inserted == 1) || if ((pci_mmcfg_resources_inserted == 1) ||
(pci_probe & PCI_PROBE_MMCONF) == 0 || (pci_probe & PCI_PROBE_MMCONF) == 0 ||
(pci_mmcfg_config_num == 0) || (pci_mmcfg_config_num == 0))
(pci_mmcfg_config[0].address == 0))
return 1; return 1;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册