]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UefiBootManagerLib: BmGetActiveConsoleIn code cleanup
authorThomas Palmer <thomas.palmer@hpe.com>
Wed, 30 Mar 2016 17:16:48 +0000 (01:16 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 31 Mar 2016 01:21:05 +0000 (09:21 +0800)
Check for NULL from AllocateCopyPool before setting Count to 1. Also
change sizeof (EFI_HANDLE*) to sizeof (EFI_HANDLE).  Handles is a
EFI_HANDLE pointer, so the allocated memory must be the size of
EFI_HANDLE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c

index b49758b236a2bf136652a37eeb4be4c970c088f4..55df7e9a5f318f1a5b41add0096bf8f4c9a9b213 100644 (file)
@@ -2,6 +2,7 @@
   Hotkey library functions.\r
 \r
 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 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
@@ -471,8 +472,10 @@ BmGetActiveConsoleIn (
                     EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
                     );\r
     if (!EFI_ERROR (Status)) {\r
-      Handles = AllocateCopyPool (sizeof (EFI_HANDLE *), &gST->ConsoleInHandle);\r
-      *Count  = 1;\r
+      Handles = AllocateCopyPool (sizeof (EFI_HANDLE), &gST->ConsoleInHandle);\r
+      if (Handles != NULL) {\r
+        *Count = 1;\r
+      }\r
     }\r
   } else {\r
     Status = gBS->LocateHandleBuffer (\r