From patchwork Sat Nov 14 00:34:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 59977 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAE0XZYK004040 for ; Sat, 14 Nov 2009 00:34:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932478AbZKNAd6 (ORCPT ); Fri, 13 Nov 2009 19:33:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932547AbZKNAd6 (ORCPT ); Fri, 13 Nov 2009 19:33:58 -0500 Received: from g1t0028.austin.hp.com ([15.216.28.35]:44537 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932478AbZKNAd5 (ORCPT ); Fri, 13 Nov 2009 19:33:57 -0500 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g1t0028.austin.hp.com (Postfix) with ESMTP id B02831C29E; Sat, 14 Nov 2009 00:34:03 +0000 (UTC) Received: from ldl (linux.corp.hp.com [15.11.146.101]) by g1t0039.austin.hp.com (Postfix) with ESMTP id A1B0A3404A; Sat, 14 Nov 2009 00:34:03 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 7BF93CF0012; Fri, 13 Nov 2009 17:34:03 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RSBOaPJs20If; Fri, 13 Nov 2009 17:34:03 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 68C15CF0008; Fri, 13 Nov 2009 17:34:03 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 5AEE226172; Fri, 13 Nov 2009 17:34:03 -0700 (MST) Subject: [PATCH v2 06/18] x86/PCI: MMCONFIG: reject MMCONFIG apertures at address zero To: Jesse Barnes From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, x86@kernel.org, Yinghai Lu Date: Fri, 13 Nov 2009 17:34:03 -0700 Message-ID: <20091114003403.30492.77944.stgit@bob.kio> In-Reply-To: <20091114003135.30492.75626.stgit@bob.kio> References: <20091114003135.30492.75626.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index a0cc4d2..067a2cf 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -41,6 +41,9 @@ static __init struct acpi_mcfg_allocation *pci_mmconfig_add(int segment, int new_num = pci_mmcfg_config_num + 1; int i = pci_mmcfg_config_num; + if (addr == 0) + return NULL; + new = kzalloc(sizeof(pci_mmcfg_config[0]) * new_num, GFP_KERNEL); if (!new) return NULL; @@ -471,8 +474,7 @@ static void __init pci_mmcfg_reject_broken(int early) typeof(pci_mmcfg_config[0]) *cfg; int i; - if ((pci_mmcfg_config_num == 0) || - (pci_mmcfg_config[0].address == 0)) + if (pci_mmcfg_config_num == 0) return; for (i = 0; i < pci_mmcfg_config_num; i++) { @@ -616,8 +618,7 @@ static void __init __pci_mmcfg_init(int early) pci_mmcfg_reject_broken(early); - if ((pci_mmcfg_config_num == 0) || - (pci_mmcfg_config[0].address == 0)) + if (pci_mmcfg_config_num == 0) return; if (pci_mmcfg_arch_init()) @@ -649,8 +650,7 @@ static int __init pci_mmcfg_late_insert_resources(void) */ if ((pci_mmcfg_resources_inserted == 1) || (pci_probe & PCI_PROBE_MMCONF) == 0 || - (pci_mmcfg_config_num == 0) || - (pci_mmcfg_config[0].address == 0)) + (pci_mmcfg_config_num == 0)) return 1; /*