public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Ray Ni <ray.ni@intel.com>, devel@edk2.groups.io
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Eric Dong <eric.dong@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
Date: Thu, 11 Jul 2019 14:14:49 +0200	[thread overview]
Message-ID: <0ed76e95-ab20-1673-8732-a5a4363a89eb@redhat.com> (raw)
In-Reply-To: <d9a04860-ef0d-a3bf-c040-1290783d8802@redhat.com>

On 07/11/19 12:02, Laszlo Ersek wrote:
> Hello Ray,
> 
> On 07/11/19 03:16, Ray Ni wrote:
>> Signed-off-by: Ray Ni <ray.ni@intel.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> index c31160735a..a3b62f7787 100644
>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> @@ -571,7 +571,7 @@ ReclaimPages (
>>    //
>>    // First, find the leaf entry has the smallest access record value
>>    //
>> -  for (Pml5Index = 0; Pml5Index < Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1; Pml5Index++) {
>> +  for (Pml5Index = 0; Pml5Index < (Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1); Pml5Index++) {
>>      if ((Pml5[Pml5Index] & IA32_PG_P) == 0 || (Pml5[Pml5Index] & IA32_PG_PMNT) != 0) {
>>        //
>>        // If the PML5 entry is not present or is masked, skip it
>>
> 
> This is not a GCC7/GCC8 build failure, but a genuine bug in the code
> that GCC7/GCC8 helpfully reported.
> 
> The conditional operator ?: has weaker precedence than the relational
> operator <, and so the patch incurs a behavioral change -- thus, it is a
> bugfix.
> 
> If we were only adding the parentheses to reinforce the operator
> bingings that are already in place, i.e., preserving the behavior,
> *then* we could call this a "build failure".
> 
> 
> (1) Please update the subject accordingly, for example:
> 
> UefiCpuPkg/PiSmmCpuDxeSmm: ReclaimPages: fix incorrect operator binding
> 
> (71 characters)
> 
> 
> (2) I'd suggest also adding, to the commit message body:
> 
> Fixes: 7365eb2c8cf1d7112330d09918c0c67e8d0b827a
> 
> With those:
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

IMPORTANT: please do not push this patch before you revert and reapply
7365eb2c8cf1; otherwise we'll get into a huge mess. Please see here:

https://edk2.groups.io/g/devel/message/43599

(Namely, if you apply this patch on top of 7365eb2c8cf1, then you won't
be able to revert 7365eb2c8cf1, which is a pre-requisite for reverting
7c5010c7f88b.)

Thanks
Laszlo

      reply	other threads:[~2019-07-11 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11  1:16 [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure Ni, Ray
2019-07-11  2:09 ` Dong, Eric
2019-07-11 10:02 ` Laszlo Ersek
2019-07-11 12:14   ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ed76e95-ab20-1673-8732-a5a4363a89eb@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox