summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen@nvidia.com>2020-09-12 01:16:30 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-09-18 02:45:21 +0000
commit698d3d7726232694018d437279dd4166e462deb7 (patch)
treeb205f29a5268888e86271b9811a529deee80ff17 /MdeModulePkg
parentb5701a4c7a0fb185e0c5b9db9525939c78664bfd (diff)
downloadedk2-698d3d7726232694018d437279dd4166e462deb7.tar.gz
edk2-698d3d7726232694018d437279dd4166e462deb7.tar.bz2
edk2-698d3d7726232694018d437279dd4166e462deb7.zip
MdeModulePkg/NonDiscoverablePciDeviceDxe: Add NULL pointer check
Add check for NULL HostAddress in AllocateBuffer as required by UEFI specification. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
index a40c1a9593..363c4a765b 100644
--- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
+++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
@@ -856,6 +856,10 @@ CoherentPciIoAllocateBuffer (
return EFI_UNSUPPORTED;
}
+ if (HostAddress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
if ((MemoryType != EfiBootServicesData) &&
(MemoryType != EfiRuntimeServicesData)) {
return EFI_INVALID_PARAMETER;