summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2015-09-09 07:50:09 +0000
committerhwu1225 <hwu1225@Edk2>2015-09-09 07:50:09 +0000
commitc9d0fe0817a87313a28b800e001ecf2b5d4bbb5a (patch)
treeb094fa873e225de6db7e6388e4be5124b4bf75ff /MdeModulePkg/Library
parentbcb9fdb5baeb9d9df6ad391129e95027d0f645cc (diff)
downloadedk2-platforms-c9d0fe0817a87313a28b800e001ecf2b5d4bbb5a.tar.xz
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. (Sync patch r18417 from main trunk.) 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/branches/UDK2015@18420 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
index 7b13ec663c..e45c0bd23a 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
@@ -186,6 +186,11 @@ BmWriteBootToOsPerformanceData (
PERF_END(NULL, "BDS", NULL, 0);
//
+ // Reset the entry count
+ //
+ mBmPerfHeader.Count = 0;
+
+ //
// Retrieve time stamp count as early as possible
//
Ticker = GetPerformanceCounter ();