summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/DxeCorePerformanceLib
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-02-09 13:21:08 +0800
committerStar Zeng <star.zeng@intel.com>2018-02-11 09:56:01 +0800
commitc9faac275bd80f34b00017ca92ce73beb0c0038f (patch)
tree02e718c70f0a87c67e6a5a70b6eb573bd3da7c36 /MdeModulePkg/Library/DxeCorePerformanceLib
parenta35918caae4d0b9bb51d0d4765117d7ca9a4d641 (diff)
downloadedk2-c9faac275bd80f34b00017ca92ce73beb0c0038f.tar.gz
edk2-c9faac275bd80f34b00017ca92ce73beb0c0038f.tar.bz2
edk2-c9faac275bd80f34b00017ca92ce73beb0c0038f.zip
MdeModulePkg/PerfLib: Add NULL pointer check for "Token"
"Token" is passed through the perf entry, it's may be NULL. So we need to add NULL pointer check before reference it. Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/DxeCorePerformanceLib')
-rw-r--r--MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 8363b0e4ed..9b3224ef6f 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -115,6 +115,10 @@ IsKnownTokens (
IN CONST CHAR8 *Token
)
{
+ if (Token == NULL) {
+ return FALSE;
+ }
+
if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
AsciiStrCmp (Token, PEI_TOK) == 0 ||
AsciiStrCmp (Token, DXE_TOK) == 0 ||
@@ -847,7 +851,7 @@ InsertFpdtMeasurement (
//
// If PERF_START()/PERF_END() have specified the ProgressID,it has high priority.
- // !!! Note: If the Pref is not the known Token used in the core but have same
+ // !!! Note: If the Perf is not the known Token used in the core but have same
// ID with the core Token, this case will not be supported.
// And in currtnt usage mode, for the unkown ID, there is a general rule:
// If it is start pref: the lower 4 bits of the ID should be 0.