summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-07-04 12:38:28 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-05 13:31:41 +0800
commit9cda0af7ecfcfc5446da13e63b1930a0d83c0f3f (patch)
tree4f4ba7deb5335c5e10a9ae81ffc8ea1de36c338c
parent6f9760d88b11d3a848c2522286f3a5b5e5214fbd (diff)
downloadedk2-9cda0af7ecfcfc5446da13e63b1930a0d83c0f3f.tar.gz
edk2-9cda0af7ecfcfc5446da13e63b1930a0d83c0f3f.tar.bz2
edk2-9cda0af7ecfcfc5446da13e63b1930a0d83c0f3f.zip
MdeModulePkg MemoryProfile: Add ASSERTs to make sure pointers are not NULL
Code logic ensures that both pointers 'DriverInfoData' and 'AllocInfoData' will not be NULL when they are used. Add ASSERTs as warning for cases that will not happen. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c3
-rw-r--r--MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
index 14c4959f9f..30c0df46d6 100644
--- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
+++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
@@ -1283,6 +1283,9 @@ CoreUpdateProfileFree (
}
}
+ ASSERT (DriverInfoData != NULL);
+ ASSERT (AllocInfoData != NULL);
+
Found = TRUE;
Context = &ContextData->Context;
diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index 281e382d5c..ac832ce38c 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -1403,6 +1403,9 @@ SmmCoreUpdateProfileFree (
}
}
+ ASSERT (DriverInfoData != NULL);
+ ASSERT (AllocInfoData != NULL);
+
Found = TRUE;
Context = &ContextData->Context;