From: Hao Wu Date: Mon, 21 Nov 2016 05:44:59 +0000 (+0800) Subject: MdeModulePkg CapsuleApp: ASSERT to ensure 'CapsuleIndex' is not NULL X-Git-Tag: edk2-stable201903~5113 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=a522ad7c192b5cf3b31d3152eb082236fbda7243 MdeModulePkg CapsuleApp: ASSERT to ensure 'CapsuleIndex' is not NULL Function GetVariable2() ensures its third (output) parameter will not be NULL when the return status is EFI_SUCCESS. This commit adds ASSERT as warnings for the case that will not happen. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Jiewen Yao --- diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c index 9291ba3af3..d09b938fed 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -285,6 +285,7 @@ DmpCapsuleStatusVariable ( NULL ); if (!EFI_ERROR(Status)) { + ASSERT (CapsuleIndex != NULL); CopyMem(CapsuleIndexData, CapsuleIndex, 11 * sizeof(CHAR16)); CapsuleIndexData[11] = 0; Print(L"CapsuleMax - %s\n", CapsuleIndexData); @@ -297,6 +298,7 @@ DmpCapsuleStatusVariable ( NULL ); if (!EFI_ERROR(Status)) { + ASSERT (CapsuleIndex != NULL); CopyMem(CapsuleIndexData, CapsuleIndex, 11 * sizeof(CHAR16)); CapsuleIndexData[11] = 0; Print(L"CapsuleLast - %s\n", CapsuleIndexData);