[edk2-devel] [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointer Variable

Zhang, Shenglei posted 1 patch 4 years, 7 months ago
Failed in applying to current master (apply log)
.../Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c | 6 ++++++
1 file changed, 6 insertions(+)
[edk2-devel] [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointer Variable
Posted by Zhang, Shenglei 4 years, 7 months ago
Add check for pointer Variable to ensure it is not NULL when used.

Cc: Michael Kubacki <michael.a.kubacki@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
 .../Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
index b53a09ab..f5125ede 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
@@ -52,6 +52,9 @@ TestPointCheckUefiSecureBoot (
   ReturnStatus = EFI_SUCCESS;
   for (Index = 0; Index < sizeof(mUefiSecureBootVariable)/sizeof(mUefiSecureBootVariable[0]); Index++) {
     Status = GetVariable2 (mUefiSecureBootVariable[Index].Name, mUefiSecureBootVariable[Index].Guid, &Variable, &Size);
+    if(Variable == NULL) {
+      return EFI_NOT_FOUND;
+    }
     if (EFI_ERROR(Status)) {
       DEBUG ((DEBUG_ERROR, "Variable - %S not found\n", mUefiSecureBootVariable[Index].Name));
       ReturnStatus = Status;
@@ -69,6 +72,9 @@ TestPointCheckUefiSecureBoot (
 
   for (Index = 0; Index < sizeof(mUefiSecureBootModeVariable)/sizeof(mUefiSecureBootModeVariable[0]); Index++) {
     Status = GetVariable2 (mUefiSecureBootModeVariable[Index].Name, mUefiSecureBootModeVariable[Index].Guid, &Variable, &Size);
+    if(Variable == NULL) {
+      return EFI_NOT_FOUND;
+    }
     if (EFI_ERROR(Status)) {
       DEBUG ((DEBUG_ERROR, "Variable - %S not found\n", mUefiSecureBootModeVariable[Index].Name));
       ReturnStatus = Status;
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46673): https://edk2.groups.io/g/devel/message/46673
Mute This Topic: https://groups.io/mt/33110622/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointer Variable
Posted by Chiu, Chasel 4 years, 7 months ago
Please extend copyright, with this update Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, September 2, 2019 8:35 PM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A <michael.a.kubacki@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointer
> Variable
> 
> Add check for pointer Variable to ensure it is not NULL when used.
> 
> Cc: Michael Kubacki <michael.a.kubacki@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
>  .../Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckU
> efiSecureBoot.c
> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckU
> efiSecureBoot.c
> index b53a09ab..f5125ede 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckU
> efiSecureBoot.c
> +++
> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckU
> efiSecureBoot.c
> @@ -52,6 +52,9 @@ TestPointCheckUefiSecureBoot (
>    ReturnStatus = EFI_SUCCESS;
>    for (Index = 0; Index <
> sizeof(mUefiSecureBootVariable)/sizeof(mUefiSecureBootVariable[0]);
> Index++) {
>      Status = GetVariable2 (mUefiSecureBootVariable[Index].Name,
> mUefiSecureBootVariable[Index].Guid, &Variable, &Size);
> +    if(Variable == NULL) {
> +      return EFI_NOT_FOUND;
> +    }
>      if (EFI_ERROR(Status)) {
>        DEBUG ((DEBUG_ERROR, "Variable - %S not found\n",
> mUefiSecureBootVariable[Index].Name));
>        ReturnStatus = Status;
> @@ -69,6 +72,9 @@ TestPointCheckUefiSecureBoot (
> 
>    for (Index = 0; Index <
> sizeof(mUefiSecureBootModeVariable)/sizeof(mUefiSecureBootModeVariabl
> e[0]); Index++) {
>      Status = GetVariable2 (mUefiSecureBootModeVariable[Index].Name,
> mUefiSecureBootModeVariable[Index].Guid, &Variable, &Size);
> +    if(Variable == NULL) {
> +      return EFI_NOT_FOUND;
> +    }
>      if (EFI_ERROR(Status)) {
>        DEBUG ((DEBUG_ERROR, "Variable - %S not found\n",
> mUefiSecureBootModeVariable[Index].Name));
>        ReturnStatus = Status;
> --
> 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46678): https://edk2.groups.io/g/devel/message/46678
Mute This Topic: https://groups.io/mt/33110622/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-