On 4/13/19 1:31 AM, Laszlo Ersek wrote:
> The IS_SECTION2() function-like macro duplicates the SECTION_SIZE()
> calculation, just to compare the computed size against 0xFFFFFF. Invoke
> SECTION_SIZE() instead; only preserve the comparison.
> 
> Cc: Liming Gao <liming....@intel.com>
> Cc: Michael D Kinney <michael.d.kin...@intel.com>
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1710
> Signed-off-by: Laszlo Ersek <ler...@redhat.com>
> ---
>  MdePkg/Include/Pi/PiFirmwareFile.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/MdePkg/Include/Pi/PiFirmwareFile.h 
> b/MdePkg/Include/Pi/PiFirmwareFile.h
> index 56efabcba3ec..a9f3bcc4eb8e 100644
> --- a/MdePkg/Include/Pi/PiFirmwareFile.h
> +++ b/MdePkg/Include/Pi/PiFirmwareFile.h
> @@ -475,21 +475,21 @@ typedef struct {
>    ///
>    /// A UINT16 that represents a particular build. Subsequent builds have 
> monotonically
>    /// increasing build numbers relative to earlier builds.
>    ///
>    UINT16                        BuildNumber;
>    CHAR16                        VersionString[1];
>  } EFI_VERSION_SECTION2;
>  
> -#define IS_SECTION2(SectionHeaderPtr) \
> -    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) 
> SectionHeaderPtr)->Size) & 0x00ffffff) == 0x00ffffff)
> -
>  #define SECTION_SIZE(SectionHeaderPtr) \
>      ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) (UINTN) 
> SectionHeaderPtr)->Size) & 0x00ffffff))
>  
> +#define IS_SECTION2(SectionHeaderPtr) \
> +    (SECTION_SIZE (SectionHeaderPtr) == 0x00ffffff)
> +
>  #define SECTION2_SIZE(SectionHeaderPtr) \
>      (((EFI_COMMON_SECTION_HEADER2 *) (UINTN) SectionHeaderPtr)->ExtendedSize)
>  
>  #pragma pack()
>  
>  #endif
>  
> 

Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39103): https://edk2.groups.io/g/devel/message/39103
Mute This Topic: https://groups.io/mt/31070301/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to