From 698d3d7726232694018d437279dd4166e462deb7 Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Sat, 12 Sep 2020 01:16:30 +0800 Subject: MdeModulePkg/NonDiscoverablePciDeviceDxe: Add NULL pointer check Add check for NULL HostAddress in AllocateBuffer as required by UEFI specification. Signed-off-by: Jeff Brasen Reviewed-by: Hao A Wu --- .../Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'MdeModulePkg/Bus') 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; -- cgit v1.2.3