diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:53:58 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 45ce0a67bb4ee80f27da93777c623f51f344f23b (patch) | |
tree | b3bfe1215f559344320027697e369afbaad14906 /FmpDevicePkg/Library | |
parent | bcdcc4160d7460c46c08c9395aae81be44ef23a9 (diff) | |
download | edk2-45ce0a67bb4ee80f27da93777c623f51f344f23b.zip edk2-45ce0a67bb4ee80f27da93777c623f51f344f23b.tar.gz edk2-45ce0a67bb4ee80f27da93777c623f51f344f23b.tar.bz2 |
FmpDevicePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the FmpDevicePkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'FmpDevicePkg/Library')
7 files changed, 390 insertions, 342 deletions
diff --git a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c index 0cb1d77..b3a41a4 100644 --- a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c +++ b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c @@ -50,7 +50,7 @@ CheckSystemPower ( EFI_STATUS
EFIAPI
CheckSystemThermal (
- OUT BOOLEAN *Good
+ OUT BOOLEAN *Good
)
{
*Good = TRUE;
@@ -73,7 +73,7 @@ CheckSystemThermal ( EFI_STATUS
EFIAPI
CheckSystemEnvironment (
- OUT BOOLEAN *Good
+ OUT BOOLEAN *Good
)
{
*Good = TRUE;
diff --git a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdatePolicyLibOnProtocol.c b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdatePolicyLibOnProtocol.c index 6f91688..34433ec 100644 --- a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdatePolicyLibOnProtocol.c +++ b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdatePolicyLibOnProtocol.c @@ -36,6 +36,7 @@ LookupCapsuleUpdatePolicyProtocol ( if (mCapsuleUpdatePolicy != NULL) {
return TRUE;
}
+
Status = gBS->LocateProtocol (
&gEdkiiCapsuleUpdatePolicyProtocolGuid,
NULL,
@@ -45,6 +46,7 @@ LookupCapsuleUpdatePolicyProtocol ( mCapsuleUpdatePolicy = NULL;
return FALSE;
}
+
return TRUE;
}
@@ -70,6 +72,7 @@ CheckSystemPower ( if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->CheckSystemPower (mCapsuleUpdatePolicy, Good);
}
+
*Good = TRUE;
return EFI_SUCCESS;
}
@@ -90,12 +93,13 @@ CheckSystemPower ( EFI_STATUS
EFIAPI
CheckSystemThermal (
- OUT BOOLEAN *Good
+ OUT BOOLEAN *Good
)
{
if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->CheckSystemThermal (mCapsuleUpdatePolicy, Good);
}
+
*Good = TRUE;
return EFI_SUCCESS;
}
@@ -116,12 +120,13 @@ CheckSystemThermal ( EFI_STATUS
EFIAPI
CheckSystemEnvironment (
- OUT BOOLEAN *Good
+ OUT BOOLEAN *Good
)
{
if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->CheckSystemEnvironment (mCapsuleUpdatePolicy, Good);
}
+
*Good = TRUE;
return EFI_SUCCESS;
}
@@ -145,6 +150,7 @@ IsLowestSupportedVersionCheckRequired ( if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->IsLowestSupportedVersionCheckRequired (mCapsuleUpdatePolicy);
}
+
return TRUE;
}
@@ -167,5 +173,6 @@ IsLockFmpDeviceAtLockEventGuidRequired ( if (LookupCapsuleUpdatePolicyProtocol ()) {
return mCapsuleUpdatePolicy->IsLockFmpDeviceAtLockEventGuidRequired (mCapsuleUpdatePolicy);
}
+
return TRUE;
}
diff --git a/FmpDevicePkg/Library/FmpDependencyCheckLib/FmpDependencyCheckLib.c b/FmpDevicePkg/Library/FmpDependencyCheckLib/FmpDependencyCheckLib.c index 31a8016..f007ef0 100644 --- a/FmpDevicePkg/Library/FmpDependencyCheckLib/FmpDependencyCheckLib.c +++ b/FmpDevicePkg/Library/FmpDependencyCheckLib/FmpDependencyCheckLib.c @@ -64,82 +64,82 @@ CheckFmpDependency ( UINTN FmpVersionsCount;
BOOLEAN IsSatisfied;
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
- FmpImageInfoBuf = NULL;
- DescriptorVer = NULL;
- DescriptorSize = NULL;
- NumberOfFmpInstance = 0;
- FmpVersions = NULL;
- FmpVersionsCount = 0;
- IsSatisfied = TRUE;
- PackageVersionName = NULL;
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
+ FmpImageInfoBuf = NULL;
+ DescriptorVer = NULL;
+ DescriptorSize = NULL;
+ NumberOfFmpInstance = 0;
+ FmpVersions = NULL;
+ FmpVersionsCount = 0;
+ IsSatisfied = TRUE;
+ PackageVersionName = NULL;
//
// Get ImageDescriptors of all FMP instances, and archive them for dependency evaluation.
//
Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareManagementProtocolGuid,
- NULL,
- &NumberOfFmpInstance,
- &HandleBuffer
- );
+ ByProtocol,
+ &gEfiFirmwareManagementProtocolGuid,
+ NULL,
+ &NumberOfFmpInstance,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "CheckFmpDependency: Get Firmware Management Protocol failed. (%r)", Status));
- IsSatisfied = FALSE;
+ IsSatisfied = FALSE;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_FMP_PROTOCOL_NOT_FOUND;
goto cleanup;
}
- FmpImageInfoBuf = AllocateZeroPool (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) * NumberOfFmpInstance);
+ FmpImageInfoBuf = AllocateZeroPool (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) * NumberOfFmpInstance);
if (FmpImageInfoBuf == NULL) {
- IsSatisfied = FALSE;
+ IsSatisfied = FALSE;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_FMP_INFO_BUFFER_FAILED;
goto cleanup;
}
- DescriptorVer = AllocateZeroPool (sizeof(UINT32) * NumberOfFmpInstance);
+ DescriptorVer = AllocateZeroPool (sizeof (UINT32) * NumberOfFmpInstance);
if (DescriptorVer == NULL ) {
- IsSatisfied = FALSE;
+ IsSatisfied = FALSE;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_DESC_VER_BUFFER_FAILED;
goto cleanup;
}
- DescriptorSize = AllocateZeroPool (sizeof(UINTN) * NumberOfFmpInstance);
+ DescriptorSize = AllocateZeroPool (sizeof (UINTN) * NumberOfFmpInstance);
if (DescriptorSize == NULL ) {
- IsSatisfied = FALSE;
+ IsSatisfied = FALSE;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_DESC_SIZE_BUFFER_FAILED;
goto cleanup;
}
- FmpVersions = AllocateZeroPool (sizeof(FMP_DEPEX_CHECK_VERSION_DATA) * NumberOfFmpInstance);
+ FmpVersions = AllocateZeroPool (sizeof (FMP_DEPEX_CHECK_VERSION_DATA) * NumberOfFmpInstance);
if (FmpVersions == NULL) {
- IsSatisfied = FALSE;
+ IsSatisfied = FALSE;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_FMP_VER_BUFFER_FAILED;
goto cleanup;
}
- for (Index = 0; Index < NumberOfFmpInstance; Index ++) {
+ for (Index = 0; Index < NumberOfFmpInstance; Index++) {
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiFirmwareManagementProtocolGuid,
- (VOID **) &Fmp
+ (VOID **)&Fmp
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
ImageInfoSize = 0;
- Status = Fmp->GetImageInfo (
- Fmp,
- &ImageInfoSize,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- );
+ Status = Fmp->GetImageInfo (
+ Fmp,
+ &ImageInfoSize,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ );
if (Status != EFI_BUFFER_TOO_SMALL) {
continue;
}
@@ -159,7 +159,7 @@ CheckFmpDependency ( &PackageVersion, // PackageVersion
&PackageVersionName // PackageVersionName
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
FreePool (FmpImageInfoBuf[Index]);
FmpImageInfoBuf[Index] = NULL;
continue;
@@ -172,7 +172,7 @@ CheckFmpDependency ( CopyGuid (&FmpVersions[FmpVersionsCount].ImageTypeId, &FmpImageInfoBuf[Index]->ImageTypeId);
FmpVersions[FmpVersionsCount].Version = FmpImageInfoBuf[Index]->Version;
- FmpVersionsCount ++;
+ FmpVersionsCount++;
}
//
@@ -189,11 +189,12 @@ CheckFmpDependency ( cleanup:
if (FmpImageInfoBuf != NULL) {
- for (Index = 0; Index < NumberOfFmpInstance; Index ++) {
+ for (Index = 0; Index < NumberOfFmpInstance; Index++) {
if (FmpImageInfoBuf[Index] != NULL) {
FreePool (FmpImageInfoBuf[Index]);
}
}
+
FreePool (FmpImageInfoBuf);
}
diff --git a/FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLib.c b/FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLib.c index 0839681..8f924cd 100644 --- a/FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLib.c +++ b/FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLib.c @@ -40,7 +40,7 @@ SaveFmpDependency ( @retval NULL
**/
-EFI_FIRMWARE_IMAGE_DEP*
+EFI_FIRMWARE_IMAGE_DEP *
EFIAPI
GetFmpDependency (
OUT UINT32 *DepexSize
diff --git a/FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c b/FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c index ad0fa65..76a1ee3 100644 --- a/FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c +++ b/FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c @@ -34,16 +34,16 @@ typedef enum { // Value of stack element
//
typedef union {
- BOOLEAN Boolean;
- UINT32 Version;
+ BOOLEAN Boolean;
+ UINT32 Version;
} ELEMENT_VALUE;
//
// Stack element used to evaluate dependency expressions
//
typedef struct {
- ELEMENT_VALUE Value;
- ELEMENT_TYPE Type;
+ ELEMENT_VALUE Value;
+ ELEMENT_TYPE Type;
} DEPEX_ELEMENT;
//
@@ -118,17 +118,17 @@ GrowDepexStack ( **/
EFI_STATUS
Push (
- IN UINT32 Value,
- IN UINTN Type
+ IN UINT32 Value,
+ IN UINTN Type
)
{
- EFI_STATUS Status;
- DEPEX_ELEMENT Element;
+ EFI_STATUS Status;
+ DEPEX_ELEMENT Element;
//
// Check Type
//
- if (Type != BooleanType && Type != VersionType) {
+ if ((Type != BooleanType) && (Type != VersionType)) {
return EFI_INVALID_PARAMETER;
}
@@ -146,7 +146,7 @@ Push ( }
Element.Value.Version = Value;
- Element.Type = Type;
+ Element.Type = Type;
//
// Push the item onto the stack
@@ -191,6 +191,7 @@ Pop ( DEBUG ((DEBUG_ERROR, "EvaluateDependency: Popped element type is mismatched!\n"));
return EFI_INVALID_PARAMETER;
}
+
return EFI_SUCCESS;
}
@@ -225,25 +226,25 @@ EvaluateDependency ( OUT UINT32 *LastAttemptStatus OPTIONAL
)
{
- EFI_STATUS Status;
- UINT8 *Iterator;
- UINT8 Index;
- DEPEX_ELEMENT Element1;
- DEPEX_ELEMENT Element2;
- GUID ImageTypeId;
- UINT32 Version;
- UINT32 LocalLastAttemptStatus;
+ EFI_STATUS Status;
+ UINT8 *Iterator;
+ UINT8 Index;
+ DEPEX_ELEMENT Element1;
+ DEPEX_ELEMENT Element2;
+ GUID ImageTypeId;
+ UINT32 Version;
+ UINT32 LocalLastAttemptStatus;
LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
//
// Check if parameter is valid.
//
- if (Dependencies == NULL || DependenciesSize == 0) {
+ if ((Dependencies == NULL) || (DependenciesSize == 0)) {
return FALSE;
}
- if (FmpVersions == NULL && FmpVersionsCount > 0) {
+ if ((FmpVersions == NULL) && (FmpVersionsCount > 0)) {
return FALSE;
}
@@ -253,216 +254,247 @@ EvaluateDependency ( //
mDepexEvaluationStackPointer = mDepexEvaluationStack;
- Iterator = (UINT8 *) Dependencies->Dependencies;
- while (Iterator < (UINT8 *) Dependencies->Dependencies + DependenciesSize) {
- switch (*Iterator)
- {
- case EFI_FMP_DEP_PUSH_GUID:
- if (Iterator + sizeof (EFI_GUID) >= (UINT8 *) Dependencies->Dependencies + DependenciesSize) {
- DEBUG ((DEBUG_ERROR, "EvaluateDependency: GUID extends beyond end of dependency expression!\n"));
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_GUID_BEYOND_DEPEX;
- goto Error;
- }
+ Iterator = (UINT8 *)Dependencies->Dependencies;
+ while (Iterator < (UINT8 *)Dependencies->Dependencies + DependenciesSize) {
+ switch (*Iterator) {
+ case EFI_FMP_DEP_PUSH_GUID:
+ if (Iterator + sizeof (EFI_GUID) >= (UINT8 *)Dependencies->Dependencies + DependenciesSize) {
+ DEBUG ((DEBUG_ERROR, "EvaluateDependency: GUID extends beyond end of dependency expression!\n"));
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_GUID_BEYOND_DEPEX;
+ goto Error;
+ }
+
+ CopyGuid (&ImageTypeId, (EFI_GUID *)(Iterator + 1));
+ Iterator = Iterator + sizeof (EFI_GUID);
- CopyGuid (&ImageTypeId, (EFI_GUID *) (Iterator + 1));
- Iterator = Iterator + sizeof (EFI_GUID);
+ for (Index = 0; Index < FmpVersionsCount; Index++) {
+ if (CompareGuid (&FmpVersions[Index].ImageTypeId, &ImageTypeId)) {
+ Status = Push (FmpVersions[Index].Version, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
- for (Index = 0; Index < FmpVersionsCount; Index ++) {
- if(CompareGuid (&FmpVersions[Index].ImageTypeId, &ImageTypeId)){
- Status = Push (FmpVersions[Index].Version, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
+ break;
}
- break;
}
- }
- if (Index == FmpVersionsCount) {
- DEBUG ((DEBUG_ERROR, "EvaluateDependency: %g is not found!\n", &ImageTypeId));
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_FMP_NOT_FOUND;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_PUSH_VERSION:
- if (Iterator + sizeof (UINT32) >= (UINT8 *) Dependencies->Dependencies + DependenciesSize ) {
- DEBUG ((DEBUG_ERROR, "EvaluateDependency: VERSION extends beyond end of dependency expression!\n"));
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_BEYOND_DEPEX;
- goto Error;
- }
- Version = *(UINT32 *) (Iterator + 1);
- Status = Push (Version, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- Iterator = Iterator + sizeof (UINT32);
- break;
- case EFI_FMP_DEP_VERSION_STR:
- Iterator += AsciiStrnLenS ((CHAR8 *) Iterator, DependenciesSize - (Iterator - Dependencies->Dependencies));
- if (Iterator == (UINT8 *) Dependencies->Dependencies + DependenciesSize) {
- DEBUG ((DEBUG_ERROR, "EvaluateDependency: STRING extends beyond end of dependency expression!\n"));
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_STR_BEYOND_DEPEX;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_AND:
- Status = Pop (&Element1, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Push (Element1.Value.Boolean & Element2.Value.Boolean, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_OR:
- Status = Pop (&Element1, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop(&Element2, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Push (Element1.Value.Boolean | Element2.Value.Boolean, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_NOT:
- Status = Pop (&Element1, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Push (!(Element1.Value.Boolean), BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_TRUE:
- Status = Push (TRUE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_FALSE:
- Status = Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_EQ:
- Status = Pop (&Element1, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = (Element1.Value.Version == Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_GT:
- Status = Pop (&Element1, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = (Element1.Value.Version > Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_GTE:
- Status = Pop (&Element1, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = (Element1.Value.Version >= Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_LT:
- Status = Pop (&Element1, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus= LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = (Element1.Value.Version < Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_LTE:
- Status = Pop (&Element1, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = Pop (&Element2, VersionType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
- goto Error;
- }
- Status = (Element1.Value.Version <= Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
- goto Error;
- }
- break;
- case EFI_FMP_DEP_END:
- Status = Pop (&Element1, BooleanType);
- if (EFI_ERROR (Status)) {
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ if (Index == FmpVersionsCount) {
+ DEBUG ((DEBUG_ERROR, "EvaluateDependency: %g is not found!\n", &ImageTypeId));
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_FMP_NOT_FOUND;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_PUSH_VERSION:
+ if (Iterator + sizeof (UINT32) >= (UINT8 *)Dependencies->Dependencies + DependenciesSize ) {
+ DEBUG ((DEBUG_ERROR, "EvaluateDependency: VERSION extends beyond end of dependency expression!\n"));
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_BEYOND_DEPEX;
+ goto Error;
+ }
+
+ Version = *(UINT32 *)(Iterator + 1);
+ Status = Push (Version, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ Iterator = Iterator + sizeof (UINT32);
+ break;
+ case EFI_FMP_DEP_VERSION_STR:
+ Iterator += AsciiStrnLenS ((CHAR8 *)Iterator, DependenciesSize - (Iterator - Dependencies->Dependencies));
+ if (Iterator == (UINT8 *)Dependencies->Dependencies + DependenciesSize) {
+ DEBUG ((DEBUG_ERROR, "EvaluateDependency: STRING extends beyond end of dependency expression!\n"));
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_STR_BEYOND_DEPEX;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_AND:
+ Status = Pop (&Element1, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Push (Element1.Value.Boolean & Element2.Value.Boolean, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_OR:
+ Status = Pop (&Element1, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Push (Element1.Value.Boolean | Element2.Value.Boolean, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_NOT:
+ Status = Pop (&Element1, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Push (!(Element1.Value.Boolean), BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_TRUE:
+ Status = Push (TRUE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_FALSE:
+ Status = Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_EQ:
+ Status = Pop (&Element1, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = (Element1.Value.Version == Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_GT:
+ Status = Pop (&Element1, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = (Element1.Value.Version > Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_GTE:
+ Status = Pop (&Element1, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = (Element1.Value.Version >= Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_LT:
+ Status = Pop (&Element1, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = (Element1.Value.Version < Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_LTE:
+ Status = Pop (&Element1, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = Pop (&Element2, VersionType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ Status = (Element1.Value.Version <= Element2.Value.Version) ? Push (TRUE, BooleanType) : Push (FALSE, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE;
+ goto Error;
+ }
+
+ break;
+ case EFI_FMP_DEP_END:
+ Status = Pop (&Element1, BooleanType);
+ if (EFI_ERROR (Status)) {
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE;
+ goto Error;
+ }
+
+ return Element1.Value.Boolean;
+ default:
+ DEBUG ((DEBUG_ERROR, "EvaluateDependency: Unknown Opcode - %02x!\n", *Iterator));
+ LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_UNKNOWN_OPCODE;
goto Error;
- }
- return Element1.Value.Boolean;
- default:
- DEBUG ((DEBUG_ERROR, "EvaluateDependency: Unknown Opcode - %02x!\n", *Iterator));
- LocalLastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_UNKNOWN_OPCODE;
- goto Error;
}
+
Iterator++;
}
@@ -504,7 +536,7 @@ ValidateDependency ( UINT8 *Depex;
if (DepexSize != NULL) {
- *DepexSize = 0;
+ *DepexSize = 0;
}
if (Dependencies == NULL) {
@@ -513,37 +545,37 @@ ValidateDependency ( Depex = Dependencies->Dependencies;
while (Depex < Dependencies->Dependencies + MaxDepexSize) {
- switch (*Depex)
- {
- case EFI_FMP_DEP_PUSH_GUID:
- Depex += sizeof (EFI_GUID) + 1;
- break;
- case EFI_FMP_DEP_PUSH_VERSION:
- Depex += sizeof (UINT32) + 1;
- break;
- case EFI_FMP_DEP_VERSION_STR:
- Depex += AsciiStrnLenS ((CHAR8 *) Depex, Dependencies->Dependencies + MaxDepexSize - Depex) + 1;
- break;
- case EFI_FMP_DEP_AND:
- case EFI_FMP_DEP_OR:
- case EFI_FMP_DEP_NOT:
- case EFI_FMP_DEP_TRUE:
- case EFI_FMP_DEP_FALSE:
- case EFI_FMP_DEP_EQ:
- case EFI_FMP_DEP_GT:
- case EFI_FMP_DEP_GTE:
- case EFI_FMP_DEP_LT:
- case EFI_FMP_DEP_LTE:
- Depex += 1;
- break;
- case EFI_FMP_DEP_END:
- Depex += 1;
- if (DepexSize != NULL) {
- *DepexSize = (UINT32)(Depex - Dependencies->Dependencies);
- }
- return TRUE;
- default:
- return FALSE;
+ switch (*Depex) {
+ case EFI_FMP_DEP_PUSH_GUID:
+ Depex += sizeof (EFI_GUID) + 1;
+ break;
+ case EFI_FMP_DEP_PUSH_VERSION:
+ Depex += sizeof (UINT32) + 1;
+ break;
+ case EFI_FMP_DEP_VERSION_STR:
+ Depex += AsciiStrnLenS ((CHAR8 *)Depex, Dependencies->Dependencies + MaxDepexSize - Depex) + 1;
+ break;
+ case EFI_FMP_DEP_AND:
+ case EFI_FMP_DEP_OR:
+ case EFI_FMP_DEP_NOT:
+ case EFI_FMP_DEP_TRUE:
+ case EFI_FMP_DEP_FALSE:
+ case EFI_FMP_DEP_EQ:
+ case EFI_FMP_DEP_GT:
+ case EFI_FMP_DEP_GTE:
+ case EFI_FMP_DEP_LT:
+ case EFI_FMP_DEP_LTE:
+ Depex += 1;
+ break;
+ case EFI_FMP_DEP_END:
+ Depex += 1;
+ if (DepexSize != NULL) {
+ *DepexSize = (UINT32)(Depex - Dependencies->Dependencies);
+ }
+
+ return TRUE;
+ default:
+ return FALSE;
}
}
@@ -568,17 +600,17 @@ ValidateDependency ( @retval Null
**/
-EFI_FIRMWARE_IMAGE_DEP*
+EFI_FIRMWARE_IMAGE_DEP *
EFIAPI
GetImageDependency (
- IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
- IN UINTN ImageSize,
- OUT UINT32 *DepexSize,
- OUT UINT32 *LastAttemptStatus OPTIONAL
+ IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
+ IN UINTN ImageSize,
+ OUT UINT32 *DepexSize,
+ OUT UINT32 *LastAttemptStatus OPTIONAL
)
{
- EFI_FIRMWARE_IMAGE_DEP *Depex;
- UINTN MaxDepexSize;
+ EFI_FIRMWARE_IMAGE_DEP *Depex;
+ UINTN MaxDepexSize;
if (Image == NULL) {
return NULL;
@@ -587,18 +619,20 @@ GetImageDependency ( //
// Check to make sure that operation can be safely performed.
//
- if (((UINTN)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength) < (UINTN)Image || \
- ((UINTN)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength) >= (UINTN)Image + ImageSize) {
+ if ((((UINTN)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength) < (UINTN)Image) || \
+ (((UINTN)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength) >= (UINTN)Image + ImageSize))
+ {
//
// Pointer overflow. Invalid image.
//
if (LastAttemptStatus != NULL) {
*LastAttemptStatus = LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_GET_DEPEX_FAILURE;
}
+
return NULL;
}
- Depex = (EFI_FIRMWARE_IMAGE_DEP*)((UINT8 *)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength);
+ Depex = (EFI_FIRMWARE_IMAGE_DEP *)((UINT8 *)Image + sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength);
MaxDepexSize = ImageSize - (sizeof (Image->MonotonicCount) + Image->AuthInfo.Hdr.dwLength);
//
diff --git a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c index 92f2021..2e5c17b 100644 --- a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c +++ b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c @@ -131,6 +131,7 @@ FmpDeviceGetSize ( if (Size == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*Size = 0;
return EFI_SUCCESS;
}
@@ -184,13 +185,14 @@ FmpDeviceGetImageTypeIdGuidPtr ( EFI_STATUS
EFIAPI
FmpDeviceGetAttributes (
- OUT UINT64 *Supported,
- OUT UINT64 *Setting
+ OUT UINT64 *Supported,
+ OUT UINT64 *Setting
)
{
- if (Supported == NULL || Setting == NULL) {
+ if ((Supported == NULL) || (Setting == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
*Supported = 0;
*Setting = 0;
return EFI_SUCCESS;
@@ -268,6 +270,7 @@ FmpDeviceGetVersionString ( if (VersionString == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*VersionString = NULL;
return EFI_UNSUPPORTED;
}
@@ -527,15 +530,15 @@ FmpDeviceSetImage ( {
UINT32 LastAttemptStatus;
- return FmpDeviceSetImageWithStatus (
- Image,
- ImageSize,
- VendorCode,
- Progress,
- CapsuleFwVersion,
- AbortReason,
- &LastAttemptStatus
- );
+ return FmpDeviceSetImageWithStatus (
+ Image,
+ ImageSize,
+ VendorCode,
+ Progress,
+ CapsuleFwVersion,
+ AbortReason,
+ &LastAttemptStatus
+ );
}
/**
diff --git a/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c b/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c index 119679c..766647f 100644 --- a/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c +++ b/FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c @@ -22,10 +22,10 @@ #pragma pack(1)
typedef struct {
- UINT32 Signature;
- UINT32 HeaderSize;
- UINT32 FwVersion;
- UINT32 LowestSupportedVersion;
+ UINT32 Signature;
+ UINT32 HeaderSize;
+ UINT32 FwVersion;
+ UINT32 LowestSupportedVersion;
} FMP_PAYLOAD_HEADER;
#pragma pack()
@@ -34,7 +34,7 @@ typedef struct { /// Identifier is used to make sure the data in the header is for this structure
/// and version. If the structure changes update the last digit.
///
-#define FMP_PAYLOAD_HEADER_SIGNATURE SIGNATURE_32 ('M', 'S', 'S', '1')
+#define FMP_PAYLOAD_HEADER_SIGNATURE SIGNATURE_32 ('M', 'S', 'S', '1')
/**
Returns the FMP Payload Header size in bytes.
@@ -61,14 +61,15 @@ GetFmpPayloadHeaderSize ( FmpPayloadHeader = NULL;
- if (Header == NULL || Size == NULL) {
+ if ((Header == NULL) || (Size == NULL)) {
return EFI_INVALID_PARAMETER;
}
FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;
- if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||
- (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||
- FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {
+ if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) ||
+ ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) ||
+ (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -106,14 +107,15 @@ GetFmpPayloadHeaderVersion ( FmpPayloadHeader = NULL;
- if (Header == NULL || Version == NULL) {
+ if ((Header == NULL) || (Version == NULL)) {
return EFI_INVALID_PARAMETER;
}
FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;
- if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||
- (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||
- FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {
+ if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) ||
+ ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) ||
+ (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -142,23 +144,24 @@ GetFmpPayloadHeaderVersion ( EFI_STATUS
EFIAPI
GetFmpPayloadHeaderLowestSupportedVersion (
- IN CONST VOID *Header,
- IN CONST UINTN FmpPayloadSize,
- OUT UINT32 *LowestSupportedVersion
+ IN CONST VOID *Header,
+ IN CONST UINTN FmpPayloadSize,
+ OUT UINT32 *LowestSupportedVersion
)
{
FMP_PAYLOAD_HEADER *FmpPayloadHeader;
FmpPayloadHeader = NULL;
- if (Header == NULL || LowestSupportedVersion == NULL) {
+ if ((Header == NULL) || (LowestSupportedVersion == NULL)) {
return EFI_INVALID_PARAMETER;
}
FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;
- if ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader ||
- (UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize ||
- FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)) {
+ if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) ||
+ ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) ||
+ (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)))
+ {
return EFI_INVALID_PARAMETER;
}
|