lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250228093024.114983-8-Neeraj.Upadhyay@amd.com>
Date: Fri, 28 Feb 2025 15:00:00 +0530
From: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
To: <kvm@...r.kernel.org>, <seanjc@...gle.com>, <pbonzini@...hat.com>
CC: <linux-kernel@...r.kernel.org>, <Thomas.Lendacky@....com>,
	<nikunj@....com>, <Santosh.Shukla@....com>, <Vasant.Hegde@....com>,
	<Suravee.Suthikulpanit@....com>, <bp@...en8.de>, <David.Kaplan@....com>,
	<huibo.wang@....com>, <naveen.rao@....com>, <pgonda@...gle.com>,
	<linux-kselftest@...r.kernel.org>, <shuah@...nel.org>
Subject: [RFC PATCH 07/31] KVM: selftests: Fix ghcb_entry returned in ghcb_alloc()

Currently, ghcb_alloc() always returns first entry. Fix
it to return an unused entry.

Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
---
 tools/testing/selftests/kvm/lib/x86/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/lib/x86/sev.c b/tools/testing/selftests/kvm/lib/x86/sev.c
index 425ec8a3a3c7..228c446072a8 100644
--- a/tools/testing/selftests/kvm/lib/x86/sev.c
+++ b/tools/testing/selftests/kvm/lib/x86/sev.c
@@ -68,7 +68,6 @@ static void sev_es_terminate(void)
 
 static struct ghcb_entry *ghcb_alloc(void)
 {
-	return &ghcb_pool->ghcbs[0];
 	struct ghcb_entry *entry;
 	struct ghcb *ghcb;
 	int i;
@@ -81,7 +80,7 @@ static struct ghcb_entry *ghcb_alloc(void)
 			entry = &ghcb_pool->ghcbs[i];
 			ghcb = &entry->ghcb;
 
-			memset(&ghcb, 0, sizeof(*ghcb));
+			memset(ghcb, 0, sizeof(*ghcb));
 			ghcb->ghcb_usage = 0;
 			ghcb->protocol_version = 1;
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ