MmCoreFfsFindMmDriver() assumes FileHeader is EFI_FFS_FILE_HEADER. If FileHeader is an EFI_FFS_FILE_HEADER2, 'FileHeader + 1' will get a wrong section address. Use FfsFindSection to get the section directly, instead of 'FileHeader + 1' to avoid this issue.
Cc: Laszlo Ersek <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Sami Mujawar <[email protected]> Cc: Ray Ni <[email protected]> Signed-off-by: Wei6 Xu <[email protected]> --- StandaloneMmPkg/Core/FwVol.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index 9d0ce66ef839..fa335d62c252 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -116,23 +116,21 @@ MmCoreFfsFindMmDriver ( break; } - Status = FfsFindSectionData ( + Status = FfsFindSection ( EFI_SECTION_GUID_DEFINED, FileHeader, - &SectionData, - &SectionDataSize + &Section ); if (EFI_ERROR (Status)) { break; } - Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1); - Status = ExtractGuidedSectionGetInfo ( - Section, - &DstBufferSize, - &ScratchBufferSize, - &SectionAttribute - ); + Status = ExtractGuidedSectionGetInfo ( + Section, + &DstBufferSize, + &ScratchBufferSize, + &SectionAttribute + ); if (EFI_ERROR (Status)) { break; } -- 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110299): https://edk2.groups.io/g/devel/message/110299 Mute This Topic: https://groups.io/mt/102270548/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
