]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update to add the ASSERT()s in the right place.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jan 2009 05:37:27 +0000 (05:37 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Jan 2009 05:37:27 +0000 (05:37 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7325 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/GenericBdsLib/BdsMisc.c

index 5779aec725c66acc9904598d1fedcb88fa4ce62b..b9e6ae7ef33f31d9c4bfc13b8438dbb8b12de840 100644 (file)
@@ -270,11 +270,14 @@ BdsLibRegisterNewOption (
                     &gEfiGlobalVariableGuid,\r
                     &TempOptionSize\r
                     );\r
-  ASSERT (TempOptionPtr != NULL);\r
   //\r
-  // Compare with current option variable\r
+  // Compare with current option variable if the previous option is set in global variable.\r
   //\r
   for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {\r
+    //\r
+    // TempOptionPtr must not be NULL if we have non-zero TempOptionSize.\r
+    //\r
+    ASSERT (TempOptionPtr != NULL);\r
 \r
     if (*VariableName == 'B') {\r
       UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);\r
@@ -336,8 +339,10 @@ BdsLibRegisterNewOption (
 \r
   if (UpdateDescription) {\r
     //\r
-    // The number in option#### to be updated\r
+    // The number in option#### to be updated. \r
+    // In this case, we must have non-NULL TempOptionPtr.\r
     //\r
+    ASSERT (TempOptionPtr != NULL);\r
     RegisterOptionNumber = TempOptionPtr[Index];\r
   } else {\r
     //\r
@@ -393,14 +398,17 @@ BdsLibRegisterNewOption (
     }\r
     return Status;\r
   }\r
-\r
+  \r
+  //\r
+  // TempOptionPtr must not be NULL if TempOptionSize is not zero.\r
+  //\r
+  ASSERT (TempOptionPtr != NULL);\r
   //\r
   // Append the new option number to the original option order\r
   //\r
   OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ;\r
   OptionOrderPtr = AllocateZeroPool ( OrderItemNum * sizeof (UINT16));\r
   ASSERT (OptionOrderPtr!= NULL);\r
-  \r
   CopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16));\r
 \r
   OptionOrderPtr[Index] = RegisterOptionNumber;\r