public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Star Zeng <star.zeng@intel.com>, Eric Dong <eric.dong@intel.com>
Subject: [PATCH 2/2] UefiCpuPkg/MtrrLib: Fix an assertion bug
Date: Wed, 10 Jan 2018 13:40:15 +0800	[thread overview]
Message-ID: <20180110054015.406612-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20180110054015.406612-1-ruiyu.ni@intel.com>

0                     40          f0         100
+---WT--+--UC--+--WT--+-----WB----+----UC----+

When calculating the shortest path from 0 to 100, the
MtrrLibCalculateLeastMtrrs() is called to update the
Vertices.Previous.
When calculating the shortest path from 0 to 40,
MtrrLibCalculateLeastMtrrs() is called recursively to update the
Vertices.Previous.
The second call corrupt the Previous value that will be used
later.
The patch removes the code that corrupts Previous.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index 768d4d5cff..30b0df030b 100644
--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
@@ -1171,7 +1171,6 @@ MtrrLibCalculateLeastMtrrs (
 
   for (Index = Start; Index <= Stop; Index++) {
     Vertices[Index].Visited = FALSE;
-    Vertices[Index].Previous = VertexCount;
     Mandatory = Weight[M(Start,Index)];
     Vertices[Index].Weight = Mandatory;
     if (Mandatory != MAX_WEIGHT) {
-- 
2.15.1.windows.2



  parent reply	other threads:[~2018-01-10  5:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  5:40 [PATCH 0/2] Quality improvement of MtrrLib Ruiyu Ni
2018-01-10  5:40 ` [PATCH 1/2] UefiCpuPkg/MtrrLib: Fix a MTRR calculation bug Ruiyu Ni
2018-01-10  5:40 ` Ruiyu Ni [this message]
2018-01-10 12:33 ` [PATCH 0/2] Quality improvement of MtrrLib Dong, Eric

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=20180110054015.406612-3-ruiyu.ni@intel.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