EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
Correct the way of handling EFI_SECTION_GUID_DEFINED type sections
with a large size
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ge Song <ge.song@hxt-semitech.com>
---
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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
On 6 March 2018 at 00:22, Ge Song <ge.song@hxt-semitech.com> wrote: > Correct the way of handling EFI_SECTION_GUID_DEFINED type sections > with a large size > > Cc: Leif Lindholm <leif.lindholm@linaro.org> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ge Song <ge.song@hxt-semitech.com> > --- > 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.biesheuvel@linaro.org> -- 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.