public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Silicon/SynQuacer/OpteeRngDxe: Fix invalid parameter check
@ 2021-06-25  4:26 ????
  0 siblings, 0 replies; only message in thread
From: ???? @ 2021-06-25  4:26 UTC (permalink / raw)
  To: Sumit Garg, Ard Biesheuvel, Leif Lindholm
  Cc: sakamoto.kazuhiko, masami.hiramatsu, devel

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."

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
---
 .../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;
   }
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-25  4:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-25  4:26 [PATCH] Silicon/SynQuacer/OpteeRngDxe: Fix invalid parameter check ????

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox