From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
To: edk2-devel@lists.01.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Leif Lindholm <leif.lindholm@linaro.org>,
Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Subject: [PATCH 2/3] EmbeddedPkg/CoherentDmaLib: Add missing checks to DmaMap
Date: Thu, 6 Sep 2018 11:55:03 -0700 [thread overview]
Message-ID: <ff4f39e7a2115949324153afa7da616a3b91eca9.1536260010.git.vladimir.olovyannikov@broadcom.com> (raw)
In-Reply-To: <ea512050c425791cd652fe395283b3dedd2f8bee.1536260010.git.vladimir.olovyannikov@broadcom.com>
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>
---
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
next prev parent reply other threads:[~2018-09-06 18:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 18:55 [PATCH 1/3] EmbeddedPkg/CoherentDmaLib: Fix typo in DmaAlignedBuffer Vladimir Olovyannikov
2018-09-06 18:55 ` Vladimir Olovyannikov [this message]
2018-09-06 18:55 ` [PATCH 3/3] MdeModulePkg/NonDiscoverablePciDeviceDxe: add missing validation Vladimir Olovyannikov
2018-09-07 10:36 ` Ard Biesheuvel
2018-12-15 13:36 ` Leif Lindholm
2018-12-17 0:16 ` Wang, Jian J
2018-12-17 0:59 ` Wang, Jian J
2018-09-07 10:37 ` [PATCH 1/3] EmbeddedPkg/CoherentDmaLib: Fix typo in DmaAlignedBuffer Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff4f39e7a2115949324153afa7da616a3b91eca9.1536260010.git.vladimir.olovyannikov@broadcom.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox