From nobody Sat May 4 04:05:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520295781522929.002734609296; Mon, 5 Mar 2018 16:23:01 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id ED76722283526; Mon, 5 Mar 2018 16:16:42 -0800 (PST) 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) 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) 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 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-ASG-Debug-ID: 1520295765-093b7e7dae25fd0001-cWE87X X-Barracuda-Envelope-From: ge.song@hxt-semitech.com From: Ge Song To: 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: [edk2] [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: , Cc: Leif Lindholm , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Ard Biesheuvel --- EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSection= Lib.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractG= uidedSectionLib.c b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiE= xtractGuidedSectionLib.c index 7b08de8ab9fe..8e7abe202836 100644 --- a/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSe= ctionLib.c +++ b/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSe= ctionLib.c @@ -123,6 +123,7 @@ ExtractGuidedSectionGetInfo ( { PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData; UINT32 Index; + EFI_GUID *SectionDefinitionGuid; =20 if (InputSection =3D=3D NULL) { return RETURN_INVALID_PARAMETER; @@ -134,11 +135,17 @@ ExtractGuidedSectionGetInfo ( =20 SavedData =3D GetSavedData(); =20 + if (IS_SECTION2 (InputSection)) { + SectionDefinitionGuid =3D &(((EFI_GUID_DEFINED_SECTION2 *) InputSectio= n)->SectionDefinitionGuid); + } else { + SectionDefinitionGuid =3D &(((EFI_GUID_DEFINED_SECTION *) InputSection= )->SectionDefinitionGuid); + } + // // Search the match registered GetInfo handler for the input guided sect= ion. // for (Index =3D 0; Index < SavedData->NumberOfExtractHandler; Index ++) { - if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_G= UID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDe= finitionGuid)) { break; } } @@ -172,6 +179,7 @@ ExtractGuidedSectionDecode ( { PRE_PI_EXTRACT_GUIDED_SECTION_DATA *SavedData; UINT32 Index; + EFI_GUID *SectionDefinitionGuid; =20 if (InputSection =3D=3D NULL) { return RETURN_INVALID_PARAMETER; @@ -182,11 +190,17 @@ ExtractGuidedSectionDecode ( =20 SavedData =3D GetSavedData(); =20 + if (IS_SECTION2 (InputSection)) { + SectionDefinitionGuid =3D &(((EFI_GUID_DEFINED_SECTION2 *) InputSectio= n)->SectionDefinitionGuid); + } else { + SectionDefinitionGuid =3D &(((EFI_GUID_DEFINED_SECTION *) InputSection= )->SectionDefinitionGuid); + } + // // Search the match registered GetInfo handler for the input guided sect= ion. // for (Index =3D 0; Index < SavedData->NumberOfExtractHandler; Index ++) { - if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], &(((EFI_G= UID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + if (CompareGuid (&SavedData->ExtractHandlerGuidTable[Index], SectionDe= finitionGuid)) { break; } } --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel