From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: michael.a.kubacki@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Fri, 23 Aug 2019 19:54:22 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 19:54:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,423,1559545200"; d="scan'208";a="191126258" Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga002.jf.intel.com with ESMTP; 23 Aug 2019 19:54:22 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Ray Ni , Rangasai V Chaganty Subject: [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: Fix NULL pointer dereference Date: Fri, 23 Aug 2019 19:54:11 -0700 Message-Id: <20190824025411.1192-1-michael.a.kubacki@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2116 Cc: Ray Ni Cc: Rangasai V Chaganty Signed-off-by: Michael Kubacki --- Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c index 956ebb2d3d..9b6135ef94 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c @@ -158,10 +158,13 @@ ProcessRequestedAccessAttribute ( } /** - return the UEFI memory information. + Return UEFI memory map information. + + @param[out] Below4GMemoryLimit The below 4GiB memory limit address or 0 if insufficient resources exist to + determine the address. + @param[out] Above4GMemoryLimit The above 4GiB memory limit address or 0 if insufficient resources exist to + determine the address. - @param[out] Below4GMemoryLimit The below 4GiB memory limit - @param[out] Above4GMemoryLimit The above 4GiB memory limit **/ VOID ReturnUefiMemoryMap ( @@ -206,7 +209,11 @@ ReturnUefiMemoryMap ( // we process bogus entries and create bogus E820 entries. // EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool (EfiMemoryMapSize); - ASSERT (EfiMemoryMap != NULL); + if (EfiMemoryMap == NULL) { + ASSERT (EfiMemoryMap != NULL); + return; + } + Status = gBS->GetMemoryMap ( &EfiMemoryMapSize, EfiMemoryMap, @@ -218,7 +225,6 @@ ReturnUefiMemoryMap ( FreePool (EfiMemoryMap); } } while (Status == EFI_BUFFER_TOO_SMALL); - ASSERT_EFI_ERROR (Status); // @@ -242,9 +248,6 @@ ReturnUefiMemoryMap ( NextEfiEntry = NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorSize); } - // - // - // DEBUG ((DEBUG_INFO, "MemoryMap:\n")); EfiEntry = EfiMemoryMap; EfiMemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) EfiMemoryMap + EfiMemoryMapSize); -- 2.16.2.windows.1