From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=223.203.96.7; helo=barracuda.hxt-semitech.com; envelope-from=ge.song@hxt-semitech.com; receiver=edk2-devel@lists.01.org Received: from barracuda.hxt-semitech.com (unknown [223.203.96.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 249B122283523 for ; Mon, 5 Mar 2018 16:16:39 -0800 (PST) X-ASG-Debug-ID: 1520295765-093b7e7dae25fd0001-cWE87X Received: from HXTBJIDCEMVIW01.hxtcorp.net ([10.128.0.14]) by barracuda.hxt-semitech.com with ESMTP id 1YSjhch7JldLpIIS (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 06 Mar 2018 08:22:45 +0800 (CST) X-Barracuda-Envelope-From: ge.song@hxt-semitech.com Received: from vbox.hxtcorp.net (10.64.17.101) by HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) with Microsoft SMTP Server (TLS) id 15.0.847.32; Tue, 6 Mar 2018 08:22:44 +0800 From: Ge Song To: CC: Leif Lindholm , Ard Biesheuvel Date: Tue, 6 Mar 2018 08:22:43 +0800 X-ASG-Orig-Subj: [edk2][Patch] EmbeddedPkg: Correct the way of handling sections with a large size Message-ID: <20180306002243.24606-1-ge.song@hxt-semitech.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [10.64.17.101] X-ClientProxiedBy: HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) To HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) X-Barracuda-Connect: UNKNOWN[10.128.0.14] X-Barracuda-Start-Time: 1520295765 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5286 1.0000 0.7500 X-Barracuda-Spam-Score: 0.75 X-Barracuda-Spam-Status: No, SCORE=0.75 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.48612 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Patch] EmbeddedPkg: Correct the way of handling sections with a large size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2018 00:16:41 -0000 Content-Type: text/plain Correct the way of handling EFI_SECTION_GUID_DEFINED type sections with a large size Cc: Leif Lindholm Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ge Song --- EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c index 7b08de8ab9fe..8e7abe202836 100644 --- a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c +++ b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c @@ -123,6 +123,7 @@ ExtractGuidedSectionGetInfo ( { PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData; UINT32 Index; + EFI_GUID *SectionDefinitionGuid; if (InputSection == NULL) { return RETURN_INVALID_PARAMETER; @@ -134,11 +135,17 @@ ExtractGuidedSectionGetInfo ( SavedData = GetSavedData(); + if (IS_SECTION2 (InputSection)) { + SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); + } else { + SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid); + } + // // Search the match registered GetInfo handler for the input guided section. // for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) { - if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) { break; } } @@ -172,6 +179,7 @@ ExtractGuidedSectionDecode ( { PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData; UINT32 Index; + EFI_GUID *SectionDefinitionGuid; if (InputSection == NULL) { return RETURN_INVALID_PARAMETER; @@ -182,11 +190,17 @@ ExtractGuidedSectionDecode ( SavedData = GetSavedData(); + if (IS_SECTION2 (InputSection)) { + SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid); + } else { + SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid); + } + // // Search the match registered GetInfo handler for the input guided section. // for (Index = 0; Index < SavedData->NumberOfExtractHandler; Index ++) { - if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDefinitionGuid)) { break; } } -- 2.11.0