public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Jaben Carsey <jaben.carsey@intel.com>, Ray Ni <ray.ni@intel.com>,
	Zhichao Gao <zhichao.gao@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [Patch v2 1/2] ShellPkg/AcpiView: Fix IA32 link error
Date: Thu,  1 Aug 2019 13:55:40 -0700	[thread overview]
Message-ID: <20190801205541.24792-2-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20190801205541.24792-1-michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=1970

Update local variable in ParseAcpiSlot() to be UINT32
instead of UINT64 to avoid 64-bit multiply operation
in the SLIT_ELEMENT() macro.

If LocalityCount is >= MAX_UINT32 and then skip the
validation check and print an INFO message instead.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Parsers/Slit/SlitParser.c                            | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
index 1f9dac66ee..6913ad8b31 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
@@ -57,8 +57,8 @@ ParseAcpiSlit (
   )
 {
   UINT32 Offset;
-  UINT64 Count;
-  UINT64 Index;
+  UINT32 Count;
+  UINT32 Index;
   UINT64 LocalityCount;
   UINT8* LocalityPtr;
   CHAR16 Buffer[80];  // Used for AsciiName param of ParseAcpi
@@ -105,6 +105,11 @@ ParseAcpiSlit (
     }
   }
 
+  if  (LocalityCount >= MAX_UINT32) {
+    Print (L"INFO: Skipping validation of System Localities as locality count is >= MAX_UINT32\n");
+    return;
+  }
+
   // Validate
   for (Count = 0; Count < LocalityCount; Count++) {
     for (Index = 0; Index < LocalityCount; Index++) {
-- 
2.21.0.windows.1


  reply	other threads:[~2019-08-01 20:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 20:55 [Patch v2 0/2] ShellPkg: Fix IA32 build failure in acpiview Michael D Kinney
2019-08-01 20:55 ` Michael D Kinney [this message]
2019-08-02  5:28   ` [edk2-devel] [Patch v2 1/2] ShellPkg/AcpiView: Fix IA32 link error Gao, Zhichao
2019-08-02 15:01     ` Michael D Kinney
2019-08-01 20:55 ` [Patch v2 2/2] ShellPkg: Add shell with all commands integrated Michael D Kinney
2019-08-02  5:35   ` [edk2-devel] " Gao, Zhichao
2019-08-02 16:18     ` Carsey, Jaben
2019-08-02 21:00     ` Michael D Kinney
2019-08-01 22:46 ` [Patch v2 0/2] ShellPkg: Fix IA32 build failure in acpiview Carsey, Jaben

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=20190801205541.24792-2-michael.d.kinney@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