Reviewed-by: Star Zeng <star.z...@intel.com> -----Original Message----- From: Wu, Hao A Sent: Monday, July 4, 2016 12:54 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a...@intel.com>; Zeng, Star <star.z...@intel.com> Subject: [PATCH] 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.z...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c | 3 +++ MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c index 14c4959..30c0df4 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 281e382..ac832ce 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; -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel