Revision: 18216
          http://sourceforge.net/p/edk2/code/18216
Author:   dandanbi
Date:     2015-08-13 00:58:56 +0000 (Thu, 13 Aug 2015)
Log Message:
-----------
MdeModulePkg: Refine the code in UiApp

Refine the code in UiApp to prevent the potential risk.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <[email protected]>

Reviewed-by: Qiu Shumin <[email protected]>
Reviewed-by: Eric Dong <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/FileExplorer.c
    trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/Variable.c

Modified: trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/FileExplorer.c
===================================================================
--- trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/FileExplorer.c  
2015-08-13 00:56:09 UTC (rev 18215)
+++ trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/FileExplorer.c  
2015-08-13 00:58:56 UTC (rev 18216)
@@ -258,7 +258,6 @@
 
   Status         = EFI_SUCCESS;
   Private        = FE_CALLBACK_DATA_FROM_THIS (This);
-  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
 
   //
   // Retrieve uncommitted data from Form Browser

Modified: trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/Variable.c
===================================================================
--- trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/Variable.c      
2015-08-13 00:56:09 UTC (rev 18215)
+++ trunk/edk2/MdeModulePkg/Application/UiApp/BootMaint/Variable.c      
2015-08-13 00:58:56 UTC (rev 18216)
@@ -524,6 +524,7 @@
 
   @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
   @retval EFI_SUCCESS          If function completes successfully.
+  @return Others Errors        Return errors from call to gRT->GetVariable.
 
 **/
 EFI_STATUS
@@ -659,7 +660,10 @@
                   Buffer
                   );
   ASSERT_EFI_ERROR (Status);
-  GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, 
&DriverOrderListSize);
+  Status = GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, 
&DriverOrderListSize);
+  if (EFI_ERROR (Status) || DriverOrderList == NULL){
+    return Status;
+  }
   NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof 
(UINT16));
   ASSERT (NewDriverOrderList != NULL);
   CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
@@ -700,6 +704,7 @@
 
   @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
   @retval EFI_SUCCESS          If function completes successfully.
+  @return Others Errors        Return errors from call to gRT->GetVariable.
 
 **/
 EFI_STATUS
@@ -824,7 +829,10 @@
                   );
   ASSERT_EFI_ERROR (Status);
 
-  GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, 
&BootOrderListSize);
+  Status = GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, 
&BootOrderListSize);
+  if (EFI_ERROR (Status) || BootOrderList == NULL){
+    return Status;
+  }
   NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
   ASSERT (NewBootOrderList != NULL);
   CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to