From: "Gao, Liming" <liming.gao@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>, "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [patch] MdeModulePkg/PerfLib: Add NULL pointer check for "Token"
Date: Fri, 9 Feb 2018 09:20:35 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1CAE88@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1518163418-23228-1-git-send-email-dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Dandan Bi
>Sent: Friday, February 09, 2018 4:04 PM
>To: edk2-devel@lists.01.org
>Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>;
>Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [patch] 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>
>---
> MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>| 6 +++++-
> MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c | 6
>+++++-
>
>MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>c | 6 +++++-
> 3 files changed, 15 insertions(+), 3 deletions(-)
>
>diff --git
>a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>index 8363b0e..9b3224e 100644
>---
>a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>+++
>b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>@@ -113,10 +113,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> 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 ||
> AsciiStrCmp (Token, BDS_TOK) == 0 ||
> AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -845,11 +849,11 @@ InsertFpdtMeasurement (
> return Status;
> }
>
> //
> // 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.
> // If it is end pref: the lower 4 bits of the ID should not be 0.
> // If input ID doesn't follow the rule, we will adjust it.
>diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>index 79b67e8..f770a35 100644
>--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>@@ -47,10 +47,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> 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 ||
> AsciiStrCmp (Token, BDS_TOK) == 0 ||
> AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -264,11 +268,11 @@ InsertPeiFpdtMeasurement (
> return Status;
> }
>
> //
> // 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.
> // If it is end pref: the lower 4 bits of the ID should not be 0.
> // If input ID doesn't follow the rule, we will adjust it.
>diff --git
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>index 2834a68..dbc1166 100644
>---
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>+++
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>@@ -83,10 +83,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> 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 ||
> AsciiStrCmp (Token, BDS_TOK) == 0 ||
> AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -495,11 +499,11 @@ InsertFpdtMeasurement (
> return Status;
> }
>
> //
> // 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.
> // If it is end pref: the lower 4 bits of the ID should not be 0.
> // If input ID doesn't follow the rule, we will adjust it.
>--
>1.9.5.msysgit.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
prev parent reply other threads:[~2018-02-09 9:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 8:03 [patch] MdeModulePkg/PerfLib: Add NULL pointer check for "Token" Dandan Bi
2018-02-09 9:20 ` Gao, Liming [this message]
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=4A89E2EF3DFEDB4C8BFDE51014F606A14E1CAE88@SHSMSX104.ccr.corp.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