From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mx.groups.io with SMTP id smtpd.web12.3225.1624595212926086564 for ; Thu, 24 Jun 2021 21:26:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=hG/Qmwxf; spf=pass (domain: linaro.org, ip: 209.85.216.42, mailfrom: masami.hiramatsu@linaro.org) Received: by mail-pj1-f42.google.com with SMTP id h23so4741771pjv.2 for ; Thu, 24 Jun 2021 21:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=YXriUXbGyDOqxJxwypFxby/N+Tb2Gsrf1z7niEL6Inw=; b=hG/QmwxfDslRa+KQg009BK3zu3+oxKtOUJOmE8WZm88NkpEWuBCeOpqwjDnJI+A5Vw jYzhtIXY61g5pSv6k1LX5hl8Ypktn3vr3yEcB9yYfcDuaGBR2eUuMiJ8naeTvwbvhd8f xvfufmBFM4tDA0kBh6uOmXtslLi5/RiPYH0n9h10ETIYjNESBA8bSgbbR7EGZaiGYO6U HirQQVwNwFERiCO+zIWZ/YDoCAFY65ScsEzGqIltZAXye9ELEXAxvWVmmDfJRp9r04jQ Pj4xBZE8h6X1Fn7//ooTqa3HKTr0HtVEy8SeghSVJSoPlLMDQ6Z/BCaXLtf2oAprh8oO LHgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=YXriUXbGyDOqxJxwypFxby/N+Tb2Gsrf1z7niEL6Inw=; b=QXUAWZ2Xc+hIHm9ne/qWnZHYtJNb+VWFN3MivoTknounWTc+ylyx7JN7tyj4ukCn/1 wIFqnB5nSyxQZ449U34QkKBFgDFXF9DNGnN6YfA6DcKGlJKTuU64/d2t0kC/eU1wYU7L qWv5888a9XdSIPMjMYGwHigis4VuxVX0gcD0FTaNpFrTwAhTNKfUVWXMc5pfUp5ohG9B mKEYRK3NVYm0GCwzAiOxRSE59mQErprLT7yzPrWWVApo2zf8oevv2VMQwRTtt6ODfKqr roZnt9z+sY1zC4A9mOwbnvNFOx2vv2L3PydsQZIlSYUO9XhVx+NomXpBAts/YB5JPVPY nRFw== X-Gm-Message-State: AOAM5300uBJt+NI4K44cFS29MR8TF5yVJ6Z41My1LkNZ0tJBU80z73Fe r6n0TYtbN0OO4CTQB98TX55PlA== X-Google-Smtp-Source: ABdhPJxhqgDKxYubSdOZImrfLdyQzHCUH2igWdtX754r1DYJrhcG8aGbfIsSE7F5hO6G/eN8G77zaw== X-Received: by 2002:a17:902:eac2:b029:107:b14c:423d with SMTP id p2-20020a170902eac2b0290107b14c423dmr7586264pld.77.1624595212455; Thu, 24 Jun 2021 21:26:52 -0700 (PDT) Return-Path: Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id h27sm4595794pfr.171.2021.06.24.21.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 21:26:51 -0700 (PDT) From: "????" To: Sumit Garg , Ard Biesheuvel , Leif Lindholm Cc: sakamoto.kazuhiko@socionext.com, masami.hiramatsu@linaro.org, devel@edk2.groups.io Subject: [PATCH] Silicon/SynQuacer/OpteeRngDxe: Fix invalid parameter check Date: Fri, 25 Jun 2021 13:26:48 +0900 Message-Id: <162459520845.449299.8490358705785712108.stgit@localhost> X-Mailer: git-send-email 2.25.1 User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Reported-by: Kazuhiko Sakamoto --- .../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; }