summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiHandleParsingLib
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:25:24 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:25:24 +0000
commit40d7a9cfaa529a8ed50a039719c09c42e05c496f (patch)
tree6c3778080fff41020d5b31a4def79b2c10bab11d /ShellPkg/Library/UefiHandleParsingLib
parent3c865f2064d37eaccd1693b878596d5138b0b38e (diff)
downloadedk2-40d7a9cfaa529a8ed50a039719c09c42e05c496f.zip
edk2-40d7a9cfaa529a8ed50a039719c09c42e05c496f.tar.gz
edk2-40d7a9cfaa529a8ed50a039719c09c42e05c496f.tar.bz2
fix a misspelling.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10905 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiHandleParsingLib')
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index c398618..107b335 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -1116,7 +1116,7 @@ ParseHandleDatabaseForChildControllers(
return Status;
}
- HandleBufferForReturn = GetHandleListByPotocol(&gEfiDriverBindingProtocolGuid);
+ HandleBufferForReturn = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid);
if (HandleBufferForReturn == NULL) {
FreePool (DriverBindingHandleBuffer);
return Status;
@@ -1311,7 +1311,7 @@ ParseHandleDatabaseForChildDevices(
**/
EFI_HANDLE*
EFIAPI
-GetHandleListByPotocol (
+GetHandleListByProtocol (
IN CONST EFI_GUID *ProtocolGuid OPTIONAL
)
{
@@ -1329,6 +1329,9 @@ GetHandleListByPotocol (
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
+ if (HandleList == NULL) {
+ return (NULL);
+ }
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
}
@@ -1336,6 +1339,9 @@ GetHandleListByPotocol (
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
+ if (HandleList == NULL) {
+ return (NULL);
+ }
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
}
@@ -1359,13 +1365,14 @@ GetHandleListByPotocol (
**/
EFI_HANDLE*
EFIAPI
-GetHandleListByPotocolList (
+GetHandleListByProtocolList (
IN CONST EFI_GUID **ProtocolGuids
)
{
EFI_HANDLE *HandleList;
UINTN Size;
UINTN TotalSize;
+ UINTN TempSize;
EFI_STATUS Status;
CONST EFI_GUID **GuidWalker;
EFI_HANDLE *HandleWalker1;
@@ -1381,7 +1388,15 @@ GetHandleListByPotocolList (
TotalSize += Size;
}
}
- HandleList = AllocatePool(TotalSize);
+
+ //
+ // No handles were found...
+ //
+ if (TotalSize == sizeof(EFI_HANDLE)) {
+ return (NULL);
+ }
+
+ HandleList = AllocateZeroPool(TotalSize);
ASSERT(HandleList != NULL);
if (HandleList == NULL) {
return (NULL);
@@ -1389,9 +1404,15 @@ GetHandleListByPotocolList (
Size = 0;
for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++){
- Size = TotalSize - Size;
- Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &Size, HandleList+((TotalSize - Size)/sizeof(EFI_HANDLE)));
- ASSERT_EFI_ERROR(Status);
+ TempSize = TotalSize - Size;
+ Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &TempSize, HandleList+((TotalSize - Size)/sizeof(EFI_HANDLE)));
+
+ //
+ // Allow for missing protocols... Only update the 'used' size upon success.
+ //
+ if (!EFI_ERROR(Status)) {
+ Size = TempSize;
+ }
}
HandleList[(TotalSize/sizeof(EFI_HANDLE))-1] = NULL;