summaryrefslogtreecommitdiff
path: root/MdePkg/Library/DxeHstiLib/HstiDxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/DxeHstiLib/HstiDxe.c')
-rw-r--r--MdePkg/Library/DxeHstiLib/HstiDxe.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c b/MdePkg/Library/DxeHstiLib/HstiDxe.c
index 2ac4dc24a282..be132e9dc2de 100644
--- a/MdePkg/Library/DxeHstiLib/HstiDxe.c
+++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c
@@ -1,13 +1,7 @@
/** @file
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -83,7 +77,7 @@ InternalHstiFindAip (
&InfoTypesBuffer,
&InfoTypesBufferCount
);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL) || (InfoTypesBufferCount == 0)) {
continue;
}
@@ -115,7 +109,7 @@ InternalHstiFindAip (
}
Hsti = InformationBlock;
- if ((Hsti->Role == Role) &&
+ if ((Hsti->Role == Role) &&
((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0))) {
break;
} else {
@@ -206,12 +200,12 @@ InternalHstiIsValidTable (
}
}
if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {
- DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n"));
+ DEBUG ((EFI_D_ERROR, "ImplementationID has no NUL CHAR\n"));
return FALSE;
}
ErrorStringSize = HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;
- ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3);
+ ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);
//
// basic check for ErrorString
@@ -311,7 +305,7 @@ HstiLibSetTable (
CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof(EFI_ADAPTER_INFORMATION_PROTOCOL));
HstiAip->HstiSize = HstiSize;
HstiAip->HstiMaxSize = HstiSize;
-
+
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
@@ -416,6 +410,7 @@ InternalHstiRecordFeaturesVerified (
Hsti,
HstiSize
);
+ FreePool (Hsti);
return Status;
}
@@ -545,6 +540,8 @@ InternalHstiRecordErrorString (
NewHsti,
NewHstiSize
);
+ FreePool (Hsti);
+ FreePool (NewHsti);
return Status;
}