]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMngr / BootManager.c
index fcf6c7bb36966b082c2cb5ece1c5d216304245b7..74649f49cea7ced18b4502f669f704f617e0cac9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform boot manager reference implementation\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -56,7 +56,7 @@ BOOT_MANAGER_CALLBACK_DATA  gBootManagerPrivate = {
 };\r
 \r
 /**\r
-  This call back funtion is registered with Boot Manager formset.\r
+  This call back function is registered with Boot Manager formset.\r
   When user selects a boot option, this call back function will\r
   be triggered. The boot option is saved for later processing.\r
 \r
@@ -172,7 +172,7 @@ InitializeBootManager (
 }\r
 \r
 /**\r
-  This funtion invokees Boot Manager. If all devices have not a chance to be connected,\r
+  This function invokes Boot Manager. If all devices have not a chance to be connected,\r
   the connect all will be triggered. It then enumerate all boot options. If \r
   a boot option from the Boot Manager page is selected, Boot Manager will boot\r
   from this boot option.\r
@@ -204,6 +204,7 @@ CallBootManager (
   CHAR16                      *HiiString;\r
   CHAR16                      *BootStringNumber;\r
   UINTN                       DevicePathType;\r
+  UINTN                       BufferSize;\r
 \r
   gOption = NULL;\r
   InitializeListHead (&BdsBootOptionList);\r
@@ -312,7 +313,10 @@ CallBootManager (
     //\r
     if (HiiString != NULL) {\r
       BootStringNumber = Option->Description;\r
-      Option->Description = AllocateZeroPool(StrSize(BootStringNumber) + StrSize(HiiString));\r
+      BufferSize = StrSize(BootStringNumber);\r
+      BufferSize += StrSize(HiiString);\r
+      Option->Description = AllocateZeroPool(BufferSize);\r
+      ASSERT (Option->Description != NULL);\r
       StrCpy (Option->Description, HiiString);\r
       if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
         StrCat (Option->Description, L" ");\r
@@ -376,7 +380,7 @@ CallBootManager (
   }\r
 \r
   //\r
-  //Will leave browser, check any reset required change is applied? if yes, reset system\r
+  // Will leave browser, check any reset required change is applied? if yes, reset system\r
   //\r
   SetupResetReminder ();\r
 \r