]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/VariablePei/Variable.c
Fix the issue that VariablePei hangs on Richford when variable region is wiped out.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / VariablePei / Variable.c
index aa43ae1512fe6eeaa75852f056edadd3f51ed3a4..844987bd0ebce7ddd7c4358fe6f9e8d306ff1078 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Framework PEIM to provide the Variable functionality\r
   \r
-Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2009 Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -426,6 +426,14 @@ FindVariable (
       Variable = IndexTable->StartPtr;\r
     } else {\r
       VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);\r
+\r
+      //\r
+      // Check if FV header is valid.\r
+      //\r
+      if (((EFI_FIRMWARE_VOLUME_HEADER *) VariableBase)->Signature != EFI_FVH_SIGNATURE) {\r
+        return EFI_UNSUPPORTED;\r
+      }\r
+\r
       VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \\r
                             ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);\r
 \r