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 <jiewen....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.z...@intel.com>
---
 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
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to