]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak
[mirror_edk2.git] / MdeModulePkg / Library / UefiBootManagerLib / BmBootDescription.c
index 6e69a1540a4552e15c8cdf350222192b3d03dd43..551df3f7ec5f1f757b2713637283236c442770cd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Library functions which relate with boot option description.\r
 \r
-Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015 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
@@ -155,6 +155,7 @@ BmGetDescriptionFromDiskInfo (
   CONST UINTN                  SerialNumberLength = 20;\r
   CHAR8                        *StrPtr;\r
   UINT8                        Temp;\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
 \r
   Description  = NULL;\r
 \r
@@ -229,6 +230,28 @@ BmGetDescriptionFromDiskInfo (
 \r
       BmEliminateExtraSpaces (Description);\r
     }\r
+  } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoSdMmcInterfaceGuid)) {\r
+    DevicePath = DevicePathFromHandle (Handle);\r
+    if (DevicePath == NULL) {\r
+      return NULL;\r
+    }\r
+\r
+    while (!IsDevicePathEnd (DevicePath) && (DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH)) {\r
+      DevicePath = NextDevicePathNode (DevicePath);\r
+    }\r
+    if (IsDevicePathEnd (DevicePath)) {\r
+      return NULL;\r
+    }\r
+\r
+    if (DevicePathSubType (DevicePath) == MSG_SD_DP) {\r
+      Description = L"SD Device";\r
+    } else if (DevicePathSubType (DevicePath) == MSG_EMMC_DP) {\r
+      Description = L"eMMC Device";\r
+    } else {\r
+      return NULL;\r
+    }\r
+\r
+    Description = AllocateCopyPool (StrSize (Description), Description);\r
   }\r
 \r
   return Description;\r
@@ -387,8 +410,8 @@ BmGetNetworkDescription (
   //   ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv6(...)\r
   //\r
   // The HTTP device path is like:\r
-  //   ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv4(...)/Uri(...)\r
-  //   ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv6(...)/Uri(...)\r
+  //   ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv4(...)[/Dns(...)]/Uri(...)\r
+  //   ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv6(...)[/Dns(...)]/Uri(...)\r
   //\r
   while (!IsDevicePathEnd (DevicePath) &&\r
          ((DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH) ||\r
@@ -438,6 +461,15 @@ BmGetNetworkDescription (
     Ip = NULL;\r
   }\r
 \r
+  //\r
+  // Skip the optional DNS node\r
+  //\r
+  if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
+      (DevicePathSubType (DevicePath) == MSG_DNS_DP)\r
+      ) {\r
+    DevicePath = NextDevicePathNode (DevicePath);\r
+  }\r
+\r
   //\r
   // Locate the URI node\r
   //\r