From c212fec9cf086243a7fb01cea185e67c2bd8f72e Mon Sep 17 00:00:00 2001 From: Tom Lendacky Date: Fri, 8 Mar 2024 07:30:14 -0800 Subject: 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 Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Laszlo Ersek Cc: Michael Roth Cc: Min Xu Reviewed-by: Gerd Hoffmann Signed-off-by: Tom Lendacky --- .../Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c index 7797febb8a..be43a44e4e 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c @@ -2,7 +2,7 @@ SEV-SNP Page Validation functions. - Copyright (c) 2021 AMD Incorporated. All rights reserved.
+ Copyright (c) 2021 - 2024, AMD Incorporated. All rights reserved.
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; } -- cgit v1.2.3