From 33f201a09c272685491504b3604001c362ff06e3 Mon Sep 17 00:00:00 2001 From: xli24 Date: Mon, 23 Mar 2009 13:16:32 +0000 Subject: [PATCH] Fix the issue that VariablePei hangs on Richford when variable region is wiped out. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7927 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/VariablePei/Variable.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/IntelFrameworkModulePkg/Universal/VariablePei/Variable.c b/IntelFrameworkModulePkg/Universal/VariablePei/Variable.c index aa43ae1512..844987bd0e 100644 --- a/IntelFrameworkModulePkg/Universal/VariablePei/Variable.c +++ b/IntelFrameworkModulePkg/Universal/VariablePei/Variable.c @@ -1,7 +1,7 @@ /** @file Framework PEIM to provide the Variable functionality -Copyright (c) 2006 - 2008 Intel Corporation.
+Copyright (c) 2006 - 2009 Intel Corporation.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -426,6 +426,14 @@ FindVariable ( Variable = IndexTable->StartPtr; } else { VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase); + + // + // Check if FV header is valid. + // + if (((EFI_FIRMWARE_VOLUME_HEADER *) VariableBase)->Signature != EFI_FVH_SIGNATURE) { + return EFI_UNSUPPORTED; + } + VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \ ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength); -- 2.39.2