From: "Masami Hiramatsu" <masami.hiramatsu@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@arm.com>,
Leif Lindholm <leif@nuviainc.com>,
Sumit Garg <sumit.garg@linaro.org>
Cc: sakamoto.kazuhiko@socionext.com, masami.hiramatsu@linaro.org,
devel@edk2.groups.io
Subject: [edk2-platforms PATCH v2 1/2] Silicon/SynQuacer/OpteeRngDxe: Fix invalid parameter check
Date: Mon, 26 Jul 2021 17:28:09 +0900 [thread overview]
Message-ID: <162728808875.823177.3243304632405478704.stgit@localhost> (raw)
In-Reply-To: <162728807883.823177.7600899853841894479.stgit@localhost>
Fix invalid parameter case according to the UEFI spec 2.9,
section 37.5 EFI_RNG_PROTOCOL.GetRNG. The spec said,
"RNGValue is null or RNGValueLength is zero." instead of
"RNGValue is NULL and RNGValueLength is non-zero."
This fixes the mOpteeRng::GetRNG() to check the invalid
parameter case correctly.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
---
Changes in v2:
- Update changelog.
---
.../SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c b/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
index 51c15b1b94..333a3e625c 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
@@ -98,8 +98,7 @@ GetInfo (
@retval EFI_NOT_READY There is not enough random data available to
satisfy the length requested by
RNGValueLength.
- @retval EFI_INVALID_PARAMETER RNGValue is NULL and RNGValueLength is
- non-zero.
+ @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.
**/
STATIC
@@ -119,7 +118,7 @@ GetRNG (
UINTN OutSize;
UINTN WaitMiliSeconds;
- if ((Value == NULL) && (ValueLength != 0)) {
+ if ((Value == NULL) || (ValueLength == 0)) {
return EFI_INVALID_PARAMETER;
}
next prev parent reply other threads:[~2021-07-26 8:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 8:27 [edk2-platforms PATCH v2 0/2] Fix some issues on SynQuacer Masami Hiramatsu
2021-07-26 8:28 ` Masami Hiramatsu [this message]
2021-07-26 8:28 ` [edk2-platforms PATCH v2 2/2] Silicon/NXP/Pcf8563RealTimeClockLib: Clear Nanosecond field in GetTime Masami Hiramatsu
2021-07-28 10:44 ` [edk2-devel] [edk2-platforms PATCH v2 0/2] Fix some issues on SynQuacer Ard Biesheuvel
2021-07-28 10:51 ` Masami Hiramatsu
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=162728808875.823177.3243304632405478704.stgit@localhost \
--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