summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-21 05:37:27 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-21 05:37:27 +0000
commita833f286fbc57c872bb073c2b1d7aa978a39efd2 (patch)
tree8f0dbc5b2fa0aaf741c6d6da17c5a6fd2f50f905 /MdeModulePkg/Library
parent4a1102c9aedce3e4244efcc822794e9cc6da4dee (diff)
downloadedk2-platforms-a833f286fbc57c872bb073c2b1d7aa978a39efd2.tar.xz
Update to add the ASSERT()s in the right place.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7325 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/GenericBdsLib/BdsMisc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c
index 5779aec725..b9e6ae7ef3 100644
--- a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c
+++ b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c
@@ -270,11 +270,14 @@ BdsLibRegisterNewOption (
&gEfiGlobalVariableGuid,
&TempOptionSize
);
- ASSERT (TempOptionPtr != NULL);
//
- // Compare with current option variable
+ // Compare with current option variable if the previous option is set in global variable.
//
for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {
+ //
+ // TempOptionPtr must not be NULL if we have non-zero TempOptionSize.
+ //
+ ASSERT (TempOptionPtr != NULL);
if (*VariableName == 'B') {
UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);
@@ -336,8 +339,10 @@ BdsLibRegisterNewOption (
if (UpdateDescription) {
//
- // The number in option#### to be updated
+ // The number in option#### to be updated.
+ // In this case, we must have non-NULL TempOptionPtr.
//
+ ASSERT (TempOptionPtr != NULL);
RegisterOptionNumber = TempOptionPtr[Index];
} else {
//
@@ -393,14 +398,17 @@ BdsLibRegisterNewOption (
}
return Status;
}
-
+
+ //
+ // TempOptionPtr must not be NULL if TempOptionSize is not zero.
+ //
+ ASSERT (TempOptionPtr != NULL);
//
// Append the new option number to the original option order
//
OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ;
OptionOrderPtr = AllocateZeroPool ( OrderItemNum * sizeof (UINT16));
ASSERT (OptionOrderPtr!= NULL);
-
CopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16));
OptionOrderPtr[Index] = RegisterOptionNumber;