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 <[email protected]>
---
 EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c 
b/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
index 8ca9e6aa5b1b..eb88fa288a99 100644
--- a/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
+++ b/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
@@ -58,6 +58,12 @@ DmaMap (
   OUT    VOID                           **Mapping
   )
 {
+  if (HostAddress == NULL ||
+      NumberOfBytes == NULL ||
+      DeviceAddress == NULL ||
+      Mapping == NULL ) {
+    return EFI_INVALID_PARAMETER;
+  }
   *DeviceAddress = HostToDeviceAddress (HostAddress);
   *Mapping = NULL;
   return EFI_SUCCESS;
-- 
2.18.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to