]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/FSVariable/FSVariable.c
EmbeddedPkg: import Lan91x Ethernet controller driver
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.c
index a8286ad9b94d6d8798f468c7330dfa612fc07f86..34b79305c87112b401dae7692a850029162e9ec2 100644 (file)
@@ -1,6 +1,12 @@
 /*++\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Caution: This file is used for Duet platform only, do not use them in real platform.\r
+All variable code, variable metadata, and variable data used by Duet platform are on \r
+disk. They can be changed by user. BIOS is not able to protoect those.\r
+Duet trusts all meta data from disk. If variable code, variable metadata and variable\r
+data is modified in inproper way, the behavior is undefined.\r
+\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -704,6 +710,11 @@ GetLangFromSupportedLangCodes (
         return CopyMem (mGlobal->PlatformLang, Supported - CompareLength, CompareLength);\r
       }\r
       SubIndex++;\r
+\r
+      //\r
+      // Skip ';' characters in Supported\r
+      //\r
+      for (; *Supported != '\0' && *Supported == ';'; Supported++);\r
     }\r
   }\r
 }\r
@@ -748,6 +759,7 @@ GetLangFromSupportedLangCodes (
 \r
 **/\r
 CHAR8 *\r
+EFIAPI\r
 VariableGetBestLanguage (\r
   IN CONST CHAR8  *SupportedLanguages, \r
   IN BOOLEAN      Iso639Language,\r
@@ -1293,7 +1305,7 @@ DuetGetVariable (
   IN      EFI_GUID          *VendorGuid,\r
   OUT     UINT32            *Attributes OPTIONAL,\r
   IN OUT  UINTN             *DataSize,\r
-  OUT     VOID              *Data\r
+  OUT     VOID              *Data OPTIONAL\r
   )\r
 /*++\r
 \r
@@ -1308,7 +1320,8 @@ Arguments:
   Attributes OPTIONAL             Attribute value of the variable found\r
   DataSize                        Size of Data found. If size is less than the\r
                                   data, this value contains the required size.\r
-  Data                            Data pointer\r
+  Data                            The buffer to return the contents of the variable. May be NULL\r
+                                  with a zero DataSize in order to determine the size buffer needed.\r
 \r
 Returns:\r
 \r
@@ -1324,6 +1337,10 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (VariableName[0] == 0) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   //\r
   // Find existing variable\r
   //\r
@@ -1682,7 +1699,7 @@ Returns:
       // since the space occupied by variables not marked with\r
       // VAR_ADDED is not allowed to be reclaimed in Runtime.\r
       //\r
-      if ((NextVariable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
+      if ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
         HwErrVariableTotalSize += VariableSize;\r
       } else {\r
         CommonVariableTotalSize += VariableSize;\r
@@ -1693,7 +1710,7 @@ Returns:
       // the space not marked as VAR_ADDED is reclaimable now.\r
       //\r
       if ((Variable->State == VAR_ADDED) || (Variable->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION))) {\r
-        if ((NextVariable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
+        if ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
           HwErrVariableTotalSize += VariableSize;\r
         } else {\r
           CommonVariableTotalSize += VariableSize;\r