From: xli24 Date: Thu, 14 Dec 2006 05:23:10 +0000 (+0000) Subject: Original BdsLibMatchDevicePaths() excludes end node when comparing 2 devices paths... X-Git-Tag: edk2-stable201903~23778 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4ef4e1eab529c7d23100643705ee0df0b027f12c Original BdsLibMatchDevicePaths() excludes end node when comparing 2 devices paths. When a short device path is the part of a long device path, the function would mistakenly recognize them as same device paths. So it should compare the entire device path, including the end node. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2099 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c index def31023c0..b88d05127a 100644 --- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c +++ b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c @@ -688,7 +688,6 @@ Returns: DevicePath = Multi; DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); - Size -= sizeof (EFI_DEVICE_PATH_PROTOCOL); // // Search for the match of 'Single' in 'Multi' @@ -698,17 +697,13 @@ Returns: // If the single device path is found in multiple device paths, // return success // - if (Size == 0) { - return FALSE; - } - if (CompareMem (Single, DevicePathInst, Size) == 0) { + gBS->FreePool (DevicePathInst); return TRUE; } gBS->FreePool (DevicePathInst); DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); - Size -= sizeof (EFI_DEVICE_PATH_PROTOCOL); } return FALSE;