From: "Chasel, Chiu" <chasel.chiu@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiewen Yao <Jiewen.yao@intel.com>,
Desimone Nathaniel L <nathaniel.l.desimone@intel.com>,
Chasel Chiu <chasel.chiu@intel.com>
Subject: [PATCH v2] IntelFsp2Pkg: Fixed potentially NULL pointer accessing
Date: Mon, 29 Oct 2018 09:17:35 +0800 [thread overview]
Message-ID: <20181029011735.1608-1-chasel.chiu@intel.com> (raw)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1280
When copying IDT table in SecMain, the pointer might be
NULL so added the check to fix it.
Test: Verified on internal platform and boots successfully.
Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
IntelFsp2Pkg/FspSecCore/SecMain.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/SecMain.c
index f319c68cc5..70460a3c8b 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.c
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
@@ -100,7 +100,7 @@ SecStartup (
// |-------------------|----> TempRamBase
IdtTableInStack.PeiService = NULL;
AsmReadIdtr (&IdtDescriptor);
- if ((IdtDescriptor.Base == 0) && (IdtDescriptor.Limit == 0xFFFF)) {
+ if (IdtDescriptor.Base == 0) {
ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);
for (Index = 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); Index ++) {
CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));
@@ -113,8 +113,9 @@ SecStartup (
// ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here!
//
CpuDeadLoop();
+ } else {
+ CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize);
}
- CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize);
}
IdtDescriptor.Base = (UINTN) &IdtTableInStack.IdtTable;
IdtDescriptor.Limit = (UINT16)(IdtSize - 1);
--
2.13.3.windows.1
next reply other threads:[~2018-10-29 1:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 1:17 Chasel, Chiu [this message]
2018-10-29 1:51 ` [PATCH v2] IntelFsp2Pkg: Fixed potentially NULL pointer accessing Yao, Jiewen
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=20181029011735.1608-1-chasel.chiu@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