Refine code to fix potential code bug.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14949 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2013-12-09 03:22:36 +00:00 committed by ydong10
parent 05de47ef04
commit 0f83ac340f
2 changed files with 9 additions and 8 deletions

View File

@ -1287,7 +1287,7 @@ IsThisVarstore (
//
// If ConfigHdr has name field and varstore not has name, return FALSE.
//
if (Name == NULL && StrStr (ConfigHdr, L"NAME=&") == NULL) {
if (Name == NULL && ConfigHdr != NULL && StrStr (ConfigHdr, L"NAME=&") == NULL) {
return FALSE;
}

View File

@ -379,12 +379,18 @@ FindStorageInList (
Link = GetFirstNode (&gBrowserStorageList);
while (!IsNull (&gBrowserStorageList, Link)) {
BrowserStorage = BROWSER_STORAGE_FROM_LINK (Link);
Link = GetNextNode (&gBrowserStorageList, Link);
if ((BrowserStorage->Type == StorageType) && CompareGuid (&BrowserStorage->Guid, StorageGuid)) {
if (StorageType == EFI_HII_VARSTORE_NAME_VALUE && BrowserStorage->HiiHandle == HiiHandle) {
if (StorageType == EFI_HII_VARSTORE_NAME_VALUE) {
if (BrowserStorage->HiiHandle == HiiHandle) {
return BrowserStorage;
}
continue;
}
ASSERT (StorageName != NULL);
if (StrCmp (BrowserStorage->Name, StorageName) == 0) {
if (StorageType == EFI_HII_VARSTORE_EFI_VARIABLE || StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
return BrowserStorage;
@ -393,11 +399,6 @@ FindStorageInList (
}
}
}
//
// Get Next Storage.
//
Link = GetNextNode (&gBrowserStorageList, Link);
}
return NULL;