From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::242; helo=mail-it0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6C9D72255D6E3 for ; Wed, 7 Mar 2018 07:51:54 -0800 (PST) Received: by mail-it0-x242.google.com with SMTP id l187so3949625ith.4 for ; Wed, 07 Mar 2018 07:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=g467SVRTrkSxbsUt2AJjAzkXqhj00YX/AoPhAXNg8z4=; b=GRtqoq4Lt3H23XcE4wfqgy1qqwwfTIM/VnnH3GA+sKGKmeErlpqw67nlgR1sKtc2RV vtciu3XguewS+sKvYsCCU+QLe9aWzVKpZ0m1GYIv8K03G2G6aSb3qOZyNHwf81ZVCOvr aEkUAH5RtcWId5SKcvbh8QC56K7i7uzUkDz2w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=g467SVRTrkSxbsUt2AJjAzkXqhj00YX/AoPhAXNg8z4=; b=Wdyx5tdZsxLFExOVE2qWCHv2WM1QEgBuj9q/72USxivrmoK9RQ1nYSxV0MzNPxWFoI PFEftZfdvbdojJaYNh5jgs0ZaIu3JusnuqeqVpZ1xTRohF0WjjjSKjGg21cZhv2GbXt0 MFzmUO82EbKi3xsMhNEtLMZW5Vbcs+YfELs1N9U1Uf3h1euPuKuH/dcsHAmxGMmVcZHM /10vdJmzAqWAsI0qIjYVvQ0jqbWBOoNG3Vb7wioqtWgRDyvBph83KonxWadIWXaBmcDa rDLLFCIPJQXtIK6MjtrcCSf5ZuvVpeeNmlf9p7pNSM6ZjzqS0pYndhxt3cnLlYZExWfV bdPA== X-Gm-Message-State: AElRT7EfCz5KrMfx/M3bIZpXOHNx8Vnb1p6mbU/nqI/LyGApdJaJD+nY K/wqMQ4YTOq3fB+z1LaHHNI0pWbCc0B1MxkI27bVXVFnKIQ= X-Google-Smtp-Source: AG47ELvsTI3V3ggFC+1cbSPMkHspYsh1stpZ69kcMsWt4gXcVS+06XVbZxCh+Nt7FLQJ2qBQVA+nkuKBZVLXMpxJwCY= X-Received: by 10.36.90.5 with SMTP id v5mr23815006ita.138.1520438288824; Wed, 07 Mar 2018 07:58:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Wed, 7 Mar 2018 07:58:08 -0800 (PST) In-Reply-To: <20180306002243.24606-1-ge.song@hxt-semitech.com> References: <20180306002243.24606-1-ge.song@hxt-semitech.com> From: Ard Biesheuvel Date: Wed, 7 Mar 2018 15:58:08 +0000 Message-ID: To: Ge Song Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [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: Wed, 07 Mar 2018 15:51:54 -0000 Content-Type: text/plain; charset="UTF-8" On 6 March 2018 at 00:22, Ge Song wrote: > 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; > Could please preserve the alignment here ... > 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; > ... and here If you fix that, you can add my Reviewed-by: Ard Biesheuvel -- Ard. > 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 > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel