summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/SmmCorePerformanceLib
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-06-27 12:37:19 +0800
committerEric Dong <eric.dong@intel.com>2018-06-28 19:46:07 +0800
commit981b7edc0e2f984c62608e9c5c5702ad106fa764 (patch)
tree8ffff6e07cd10ce7666dec9f0dfed0b1faa63e3f /MdeModulePkg/Library/SmmCorePerformanceLib
parentecd0f8b12f90a603d61c8263134599f7911bbc07 (diff)
downloadedk2-981b7edc0e2f984c62608e9c5c5702ad106fa764.tar.gz
edk2-981b7edc0e2f984c62608e9c5c5702ad106fa764.tar.bz2
edk2-981b7edc0e2f984c62608e9c5c5702ad106fa764.zip
MdeModulePkg/PerformanceLib: Add NULL pointer check
1. Add NULL pointer check for the "Guid" parameter when handle FPDT_DUAL_GUID_STRING_EVENT_TYPE. 2. Make the code logic in DxeCore/SmmCore/PeiPerformanceLib aligned when handle FPDT_DUAL_GUID_STRING_EVENT_TYPE. Cc: Liming Gao <liming.gao@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/SmmCorePerformanceLib')
-rw-r--r--MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index 0c00fb51e8..f18c3fb60d 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -649,14 +649,13 @@ InsertFpdtRecord (
case PERF_EVENTSIGNAL_END_ID:
case PERF_CALLBACK_START_ID:
case PERF_CALLBACK_END_ID:
- if (String == NULL) {
+ if (String == NULL || Guid == NULL) {
return EFI_INVALID_PARAMETER;
}
- //
- // Cache the event guid in string event record when PcdEdkiiFpdtStringRecordEnableOnly == TRUE
- //
- CopyGuid (&ModuleGuid, Guid);
StringPtr = String;
+ if (AsciiStrLen (String) == 0) {
+ StringPtr = "unknown name";
+ }
if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
FpdtRecordPtr.DualGuidStringEvent->Header.Type = FPDT_DUAL_GUID_STRING_EVENT_TYPE;
FpdtRecordPtr.DualGuidStringEvent->Header.Length = sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD);
@@ -734,7 +733,14 @@ InsertFpdtRecord (
FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
- CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
+ if (Guid != NULL) {
+ //
+ // Cache the event guid in string event record.
+ //
+ CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, Guid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
+ } else {
+ CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
+ }
if (AsciiStrLen (StringPtr) == 0) {
StringPtr = "unknown name";
}