From 79749182129c18166cad883876b98b3b1e7ff668 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Mon, 16 Mar 2009 09:57:10 +0000 Subject: Fix tracker 202216:linux runtime test issue. [Root Cause] The root cause is that in FindVariable function, original code logic will traverse all variable stored in variable volatile/non-volatile area. If the non-variable area is full and Linux sets a new variable, the caller of GetNextVariablePtr will get the address of next memory block, but this block doesn't be reserved as RUNTIME attribute. Therefore its corresponding page translation table doesn't exist and causes linux kernel panic. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7890 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 98da3b8b79..7a69a223c4 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -930,7 +930,7 @@ FindVariable ( InDeletedVariable = NULL; InDeletedStorageIndex = 0; for (Index = 0; Index < 2; Index++) { - while (IsValidVariableHeader (Variable[Index]) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) { + while ((Variable[Index] < GetEndPointer (VariableStoreHeader[Index])) && IsValidVariableHeader (Variable[Index])) { if (Variable[Index]->State == VAR_ADDED || Variable[Index]->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED) ) { @@ -2090,10 +2090,10 @@ FvbNotificationEvent ( Status = VariableCommonInitialize (Fvb); ASSERT_EFI_ERROR (Status); - SystemTable->RuntimeServices->GetVariable = RuntimeServiceGetVariable; + SystemTable->RuntimeServices->GetVariable = RuntimeServiceGetVariable; SystemTable->RuntimeServices->GetNextVariableName = RuntimeServiceGetNextVariableName; - SystemTable->RuntimeServices->SetVariable = RuntimeServiceSetVariable; - SystemTable->RuntimeServices->QueryVariableInfo = RuntimeServiceQueryVariableInfo; + SystemTable->RuntimeServices->SetVariable = RuntimeServiceSetVariable; + SystemTable->RuntimeServices->QueryVariableInfo = RuntimeServiceQueryVariableInfo; // // Now install the Variable Runtime Architectural Protocol on a new handle -- cgit v1.2.3