diff options
Diffstat (limited to 'EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c')
-rw-r--r-- | EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c index da711ebe48..a3992f7ebd 100644 --- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -60,43 +60,6 @@ ReleaseLockOnlyAtBootTime ( }
STATIC
-UINT32
-EFIAPI
-ArrayLength (
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Determine the length of null terminated char16 array.
-
-Arguments:
-
- String Null-terminated CHAR16 array pointer.
-
-Returns:
-
- UINT32 Number of bytes in the string, including the double NULL at the end;
-
---*/
-{
- UINT32 Count;
-
- if (NULL == String) {
- return 0;
- }
-
- Count = 0;
-
- while (0 != String[Count]) {
- Count++;
- }
-
- return (Count * 2) + 2;
-}
-
-STATIC
BOOLEAN
EFIAPI
IsValidVariableHeader (
@@ -600,7 +563,7 @@ Returns: return EFI_SUCCESS;
} else {
if (CompareGuid (VendorGuid, &Variable[Index]->VendorGuid)) {
- if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), ArrayLength (VariableName))) {
+ if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize)) {
PtrTrack->CurrPtr = Variable[Index];
PtrTrack->Volatile = (BOOLEAN) Index;
return EFI_SUCCESS;
@@ -876,7 +839,7 @@ Returns: //
Status = EFI_WRITE_PROTECTED;
goto Done;
- } else if (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE) {
+ } else if (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE) {
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
@@ -985,7 +948,7 @@ Returns: //
NextVariable->Reserved = 0;
VarNameOffset = sizeof (VARIABLE_HEADER);
- VarNameSize = ArrayLength (VariableName);
+ VarNameSize = StrSize (VariableName);
CopyMem (
(UINT8 *) ((UINTN) NextVariable + VarNameOffset),
VariableName,
|