Reviewed-by: Jiewen Yao <jiewen....@intel.com>

> -----Original Message-----
> From: Xu, Min M <min.m...@intel.com>
> Sent: Sunday, November 27, 2022 3:00 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m...@intel.com>; Aktas, Erdem
> <erdemak...@google.com>; James Bottomley <j...@linux.ibm.com>; Yao,
> Jiewen <jiewen....@intel.com>; Gerd Hoffmann <kra...@redhat.com>;
> Tom Lendacky <thomas.lenda...@amd.com>
> Subject: [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to
> NvVarStoreFV HeaderLength
> 
> From: Min M Xu <min.m...@intel.com>
> 
> There should be a check that the FV HeaderLength cannot be an odd
> number. Otherwise in the following CalculateSum16 there would be an
> ASSERT.
> 
> In ValidateFvHeader@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
> there a is similar check to the FwVolHeader->HeaderLength.
> 
> Cc: Erdem Aktas <erdemak...@google.com>
> Cc: James Bottomley <j...@linux.ibm.com>
> Cc: Jiewen Yao <jiewen....@intel.com>
> Cc: Gerd Hoffmann <kra...@redhat.com>
> Cc: Tom Lendacky <thomas.lenda...@amd.com>
> Signed-off-by: Min Xu <min.m...@intel.com>
> ---
>  OvmfPkg/Library/PlatformInitLib/Platform.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c
> b/OvmfPkg/Library/PlatformInitLib/Platform.c
> index 2582689ffe35..77f22de046f2 100644
> --- a/OvmfPkg/Library/PlatformInitLib/Platform.c
> +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c
> @@ -653,6 +653,7 @@ PlatformValidateNvVarStore (
>        (!CompareGuid (&FvHdrGUID, &NvVarStoreFvHeader->FileSystemGuid))
> ||
>        (NvVarStoreFvHeader->Signature != EFI_FVH_SIGNATURE) ||
>        (NvVarStoreFvHeader->Attributes != 0x4feff) ||
> +      ((NvVarStoreFvHeader->HeaderLength & 0x01) != 0) ||
>        (NvVarStoreFvHeader->Revision != EFI_FVH_REVISION) ||
>        (NvVarStoreFvHeader->FvLength != NvVarStoreSize)
>        )
> --
> 2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96815): https://edk2.groups.io/g/devel/message/96815
Mute This Topic: https://groups.io/mt/95285469/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to