From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.85.128.68, mailfrom: philmd@redhat.com) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by groups.io with SMTP; Mon, 15 Apr 2019 10:01:49 -0700 Received: by mail-wm1-f68.google.com with SMTP id y197so9589349wmd.0 for ; Mon, 15 Apr 2019 10:01:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HtSh1XFYvupuw/WXSj4Z+f9WXABsGXmaWGfviHNKatU=; b=gtK3/DRUYPKevTXAxiEHmRzOQcJ0N/JrkSxO1vshMWhDvwDe1wlFiZD/lnMqaCHoDZ 7c/RLHDNVuvzJ/fx9HFp21/sOL/943jHf6xZtU+nuqG0evzhUlZ4JK+3Wd1bn0XSpnSR 00xSMQB75NA+DJJ7cRwv2fXjYcTbeWOuCBAnfk/VQtYUpLUlJdU7SlhkqodOniKGoYSF EIInvUz58G3MXpFWb5QJ5a6+UPCc0v8Dmy0P7x18AqK70zYnj1+wksUnAYV0puYgsJY+ lZM5NRHJaZJ4ABDihf5GmcUzvJvAH++m4fQ3ixDjijK59K8vbDWaW/YYxAcDU6HLlpMU queA== X-Gm-Message-State: APjAAAUgsWNetx8YJVOzfTR0hQV9GfRf9oVL5ApFF7rDfN6KOkj7tqpQ x5YwdWG6LM0166YXRaoAZQ81Qg== X-Google-Smtp-Source: APXvYqyXDyCugo3XhanPTsq1o0rGAKpG6l8cEk/RCI8RqDk2jfQQAZx81EMPgL0jFbjExr1AwIQyaA== X-Received: by 2002:a1c:808c:: with SMTP id b134mr22586632wmd.16.1555347703093; Mon, 15 Apr 2019 10:01:43 -0700 (PDT) Return-Path: Received: from [10.32.224.40] (red-hat-inc.vlan560.asr1.mad1.gblx.net. [159.63.51.90]) by smtp.gmail.com with ESMTPSA id u189sm19912735wme.25.2019.04.15.10.01.41 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 10:01:42 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 01/10] MdePkg/PiFirmwareFile: express IS_SECTION2 in terms of SECTION_SIZE To: devel@edk2.groups.io, lersek@redhat.com Cc: Liming Gao , Michael D Kinney References: <20190412233128.4756-1-lersek@redhat.com> <20190412233128.4756-2-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: Date: Mon, 15 Apr 2019 19:01:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190412233128.4756-2-lersek@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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 > Cc: Michael D Kinney > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1710 > Signed-off-by: Laszlo Ersek > --- > 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é