Looks good, reviewed by [email protected]

-----Original Message-----
From: Zeng, Star 
Sent: Thursday, October 15, 2015 10:58 AM
To: [email protected]
Cc: Yao, Jiewen
Subject: [PATCH] MdeModulepkg VarCheckLib: Return NULL when no property set

to variable with wildcard name.

VarCheckLib has zeroed property for variable with wildcard name and is waiting 
for property set. The code should return NULL when no property set to variable 
with wildcard name, but not return the zeroed property that will impact the 
functionality of SetVariableCheck.

The issue does not appear with VarCheckUefiLib linked as the library just has 
the expected property set.

Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
---
 MdeModulePkg/Library/VarCheckLib/VarCheckLib.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.c 
b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.c
index cf00154..3d1f8f6 100644
--- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.c
+++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.c
@@ -141,11 +141,19 @@ VariablePropertyGetWithWildcardName (
             VarCheckInternalIsHexaDecimalDigitCharacter 
(VariableName[NameLength + 1]) &&
             VarCheckInternalIsHexaDecimalDigitCharacter 
(VariableName[NameLength + 2]) &&
             VarCheckInternalIsHexaDecimalDigitCharacter 
(VariableName[NameLength + 3])) {
-          return &mVarCheckVariableWithWildcardName[Index].VariableProperty;
+          if 
(mVarCheckVariableWithWildcardName[Index].VariableProperty.Revision != 
VAR_CHECK_VARIABLE_PROPERTY_REVISION) {
+            return NULL;
+          } else {
+            return &mVarCheckVariableWithWildcardName[Index].VariableProperty;
+          }
         }
       }
       if (StrCmp (mVarCheckVariableWithWildcardName[Index].Name, VariableName) 
== 0) {
-        return  &mVarCheckVariableWithWildcardName[Index].VariableProperty;
+        if (mVarCheckVariableWithWildcardName[Index].VariableProperty.Revision 
!= VAR_CHECK_VARIABLE_PROPERTY_REVISION) {
+          return NULL;
+        } else {
+          return  &mVarCheckVariableWithWildcardName[Index].VariableProperty;
+        }
       }
     }
   }
--
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to