]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/CoherentDmaLib: Add missing checks to DmaMap
authorVladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Thu, 6 Sep 2018 18:55:03 +0000 (11:55 -0700)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 7 Sep 2018 10:23:32 +0000 (12:23 +0200)
UEFI Sct validates Dma mapping. For CoherentDmaLib it always failed
because there were no required checks present in DmaMap.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c

index 8ca9e6aa5b1b0ba233cf78cc70e74bf29dba8cbd..eb88fa288a99b649f004dc9d95c09ef67a83c4fd 100644 (file)
@@ -58,6 +58,12 @@ DmaMap (
   OUT    VOID                           **Mapping\r
   )\r
 {\r
+  if (HostAddress == NULL ||\r
+      NumberOfBytes == NULL ||\r
+      DeviceAddress == NULL ||\r
+      Mapping == NULL ) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
   *DeviceAddress = HostToDeviceAddress (HostAddress);\r
   *Mapping = NULL;\r
   return EFI_SUCCESS;\r