OvmfPkg/BaseMemEncryptLib: Fix error check from AsmRmpAdjust()

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654

The AsmRmpAdjust() function returns a UINT32, however in SevSnpIsVmpl0()
the return value is checked with EFI_ERROR() when it should just be
compared to 0. Fix the error check.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: Min Xu <min.m.xu@intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
This commit is contained in:
Tom Lendacky 2024-03-08 07:30:14 -08:00 committed by mergify[bot]
parent 61185f1d50
commit c212fec9cf
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
SEV-SNP Page Validation functions.
Copyright (c) 2021 AMD Incorporated. All rights reserved.<BR>
Copyright (c) 2021 - 2024, AMD Incorporated. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -31,8 +31,8 @@ SevSnpIsVmpl0 (
VOID
)
{
UINT64 Rdx;
EFI_STATUS Status;
UINT64 Rdx;
UINT32 Status;
//
// There is no straightforward way to query the current VMPL level.
@ -44,7 +44,7 @@ SevSnpIsVmpl0 (
Rdx = 1;
Status = AsmRmpAdjust ((UINT64)gVmpl0Data, 0, Rdx);
if (EFI_ERROR (Status)) {
if (Status != 0) {
return FALSE;
}