MdeModulePkg: Fix a performance data buffer overrun issue

The mBmPerfHeader.Count isn't reset to 0 in BmWriteBootToOsPerformanceData()
so when the actual performance data entry count exceeds the LimitCount,
the performance data collection breaks on condition
if (mBmPerfHeader.Count == LimitCount), but 2nd time calling this function
will not break on condition if (mBmPerfHeader.Count == LimitCount) because
the mBmPerfHeader.Count always bigger than LimitCount, which results buffer
overrun.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18417 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ruiyu Ni 2015-09-09 05:43:44 +00:00 committed by niruiyu
parent 8337590c42
commit 88cbb6be4e
1 changed files with 5 additions and 0 deletions

View File

@ -185,6 +185,11 @@ BmWriteBootToOsPerformanceData (
//
PERF_END(NULL, "BDS", NULL, 0);
//
// Reset the entry count
//
mBmPerfHeader.Count = 0;
//
// Retrieve time stamp count as early as possible
//