From: "Mark Wilson" <mark.wilson@amd.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: [PATCH v3 1/1] UefiCpuPkg: Clean up save state boundary checks and comments.
Date: Thu, 12 Nov 2020 18:05:18 -0600 [thread overview]
Message-ID: <20201113000518.338-2-Mark.Wilson@amd.com> (raw)
In-Reply-To: <20201113000518.338-1-Mark.Wilson@amd.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2956
In functions ReadSaveStateRegisterByIndex and WriteSaveStateRegister:
* check width > 4 instead of >= 4 when writing upper 32 bytes.
- This improves the code but will not affect functionality.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Mark Wilson <Mark.Wilson@amd.com>
---
UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
index 661cc51f361a..0ab5e1ba0f14 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
@@ -315,12 +315,12 @@ ReadSaveStateRegisterByIndex (
}
//
- // Write lower 32-bits of return buffer
+ // Write at most 4 of the lower bytes of the return buffer
//
CopyMem(Buffer, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, MIN(4, Width));
- if (Width >= 4) {
+ if (Width > 4) {
//
- // Write upper 32-bits of return buffer
+ // Write at most 4 of the upper bytes of the return buffer
//
CopyMem((UINT8 *)Buffer + 4, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, Width - 4);
}
@@ -539,12 +539,12 @@ WriteSaveStateRegister (
}
//
- // Write lower 32-bits of SMM State register
+ // Write at most 4 of the lower bytes of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, Buffer, MIN (4, Width));
- if (Width >= 4) {
+ if (Width > 4) {
//
- // Write upper 32-bits of SMM State register
+ // Write at most 4 of the upper bytes of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, (UINT8 *)Buffer + 4, Width - 4);
}
--
2.28.0.windows.1
next prev parent reply other threads:[~2020-11-13 0:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 0:05 [PATCH v2 0/1] UefiCpuPkg: Clean up save state boundary checks and comments Mark Wilson
2020-11-13 0:05 ` Mark Wilson [this message]
2021-08-26 17:55 ` [PATCH v3 1/1] " Ni, Ray
2020-11-13 22:43 ` [edk2-devel] [PATCH v2 0/1] " Laszlo Ersek
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=20201113000518.338-2-Mark.Wilson@amd.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