[edk2-devel] [PATCH] Silicon/SynQuacer/OpteeRngDxe: Fix invalid parameter check

???? masami.hiramatsu at linaro.org
Fri Jun 25 04:26:48 UTC 2021


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 at linaro.org>
Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko at 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;
   }
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77085): https://edk2.groups.io/g/devel/message/77085
Mute This Topic: https://groups.io/mt/83784781/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list