mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
a35918caae
commit
c9faac275b
|
@ -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.
|
||||
|
|
|
@ -49,6 +49,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 ||
|
||||
|
@ -266,7 +270,7 @@ InsertPeiFpdtMeasurement (
|
|||
|
||||
//
|
||||
// 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.
|
||||
|
|
|
@ -85,6 +85,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 ||
|
||||
|
@ -497,7 +501,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.
|
||||
|
|
Loading…
Reference in New Issue