MdeModulePkg/FvSimpleFileSystem: fix assertions when FV is empty
The original code will assert when dealing with those empty FVs. The fix is used to solve this bug. Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
This commit is contained in:
@ -526,7 +526,10 @@ FvSimpleFileSystemOpen (
|
|||||||
InitializeListHead (&NewFile->Link);
|
InitializeListHead (&NewFile->Link);
|
||||||
InsertHeadList (&Instance->FileHead, &NewFile->Link);
|
InsertHeadList (&Instance->FileHead, &NewFile->Link);
|
||||||
|
|
||||||
NewFile->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
NewFile->DirReadNext = NULL;
|
||||||
|
if (!IsListEmpty (&Instance->FileInfoHead)) {
|
||||||
|
NewFile->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
||||||
|
}
|
||||||
|
|
||||||
*NewHandle = &NewFile->FileProtocol;
|
*NewHandle = &NewFile->FileProtocol;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -821,7 +824,9 @@ FvSimpleFileSystemSetPosition (
|
|||||||
//
|
//
|
||||||
// Reset directory position to first entry
|
// Reset directory position to first entry
|
||||||
//
|
//
|
||||||
File->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
if (File->DirReadNext) {
|
||||||
|
File->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
||||||
|
}
|
||||||
} else if (Position == 0xFFFFFFFFFFFFFFFFull) {
|
} else if (Position == 0xFFFFFFFFFFFFFFFFull) {
|
||||||
File->Position = File->FvFileInfo->FileInfo.FileSize;
|
File->Position = File->FvFileInfo->FileInfo.FileSize;
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +223,11 @@ FvSimpleFileSystemOpenVolume (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
Instance->Root->DirReadNext = NULL;
|
||||||
|
if (!IsListEmpty (&Instance->FileInfoHead)) {
|
||||||
|
Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);
|
||||||
|
}
|
||||||
|
|
||||||
*RootFile = &Instance->Root->FileProtocol;
|
*RootFile = &Instance->Root->FileProtocol;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user