From 419a271d2e2c2f1903e139892de64fd109b7c99b Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Thu, 29 Oct 2015 03:26:00 +0000 Subject: [PATCH] MdeModulePkg: Do not dump NULL padding resource descriptor Add a check for ResourcePaddingDescriptors being a valid pointer in DumpPpbPaddingResource() to prevent looping on memory not owned by PciBusDxe. The ResourcePaddingDescriptors is initialized to NULL when the PCI_IO_DEVICE structure is allocated and remains NULL if no PCI hot plug controllers are present. This issue is only observed when DEBUG_CODE() macros are enabled and was introduced by the following patch: [edk2] [Patch] MdeModulePkg: Fix a PciBusDxe hot plug bug SVN revsion 18658 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Feng Tian Reviewed-by: Kinney Michael git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18696 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 030ef42320..a6ade26e3a 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -340,6 +340,10 @@ DumpPpbPaddingResource ( EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; PCI_BAR_TYPE Type; + if (PciIoDevice->ResourcePaddingDescriptors == NULL) { + return; + } + if (ResourceType == PciBarTypeIo16 || ResourceType == PciBarTypeIo32) { ResourceType = PciBarTypeIo; } -- 2.39.2