diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2015-05-20 07:41:01 +0000 |
---|---|---|
committer | niruiyu <niruiyu@Edk2> | 2015-05-20 07:41:01 +0000 |
commit | eef538572fcb961bdf8fdabcfe8c094c3fe8708c (patch) | |
tree | 3d876b99d1a0b0b5845f088be75e59b6757ce1bd /MdeModulePkg | |
parent | 9d02f824bb50646d32bfa3ffadf0f8d6a896fdc3 (diff) | |
download | edk2-platforms-eef538572fcb961bdf8fdabcfe8c094c3fe8708c.tar.xz |
MdeModulePkg: Add assertion to make code easier for read.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17483 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c index 2a42a7d354..6b9690a37c 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c @@ -100,6 +100,8 @@ BmGetFreeOptionNumber ( LoadOptionType == LoadOptionTypeSysPrep);
GetEfiGlobalVariable2 (mBmLoadOptionOrderName[LoadOptionType], (VOID **) &OptionOrder, &OptionOrderSize);
+ ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
+
BootNext = NULL;
if (LoadOptionType == LoadOptionTypeBoot) {
GetEfiGlobalVariable2 (L"BootNext", (VOID**) &BootNext, NULL);
@@ -268,6 +270,7 @@ BmAddOptionNumberToOrderVariable ( // Update the option order variable
//
GetEfiGlobalVariable2 (OptionOrderName, (VOID **) &OptionOrder, &OptionOrderSize);
+ ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
Status = EFI_SUCCESS;
for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
@@ -557,6 +560,8 @@ EfiBootManagerDeleteLoadOptionVariable ( // If the associated *Order exists, just remove the reference in *Order.
//
GetEfiGlobalVariable2 (mBmLoadOptionOrderName[OptionType], (VOID **) &OptionOrder, &OptionOrderSize);
+ ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
+
for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
if (OptionOrder[Index] == OptionNumber) {
OptionOrderSize -= sizeof (UINT16);
|