[PATCH v1 09/10] KVM: arm64: selftests: Free the VMs in smccc_filter and psci_test
From: Fuad Tabba
Date: Mon Sep 28 2026 - 11:36:24 EST
test_pad_must_be_zero() and host_test_system_off2() create a VM and
never free it, unlike every other test in their files. Free them.
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
tools/testing/selftests/kvm/arm64/psci_test.c | 5 ++++-
tools/testing/selftests/kvm/arm64/smccc_filter.c | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/arm64/psci_test.c b/tools/testing/selftests/kvm/arm64/psci_test.c
index e775faf208680..7feb7394fe110 100644
--- a/tools/testing/selftests/kvm/arm64/psci_test.c
+++ b/tools/testing/selftests/kvm/arm64/psci_test.c
@@ -239,9 +239,10 @@ static void host_test_system_off2(void)
u64 psci_version = 0;
int nr_shutdowns = 0;
struct kvm_run *run;
+ struct kvm_vm *vm;
struct ucall uc;
- setup_vm(guest_test_system_off2, &source, &target);
+ vm = setup_vm(guest_test_system_off2, &source, &target);
psci_version = vcpu_get_reg(target, KVM_REG_ARM_PSCI_VERSION);
@@ -276,6 +277,8 @@ static void host_test_system_off2(void)
TEST_ASSERT(get_ucall(source, &uc) == UCALL_DONE, "Guest did not exit cleanly");
TEST_ASSERT(nr_shutdowns == 2, "Two shutdown events were expected, but saw %d", nr_shutdowns);
+
+ kvm_vm_free(vm);
}
int main(void)
diff --git a/tools/testing/selftests/kvm/arm64/smccc_filter.c b/tools/testing/selftests/kvm/arm64/smccc_filter.c
index 21e41880261b4..d5e4ba074a5c6 100644
--- a/tools/testing/selftests/kvm/arm64/smccc_filter.c
+++ b/tools/testing/selftests/kvm/arm64/smccc_filter.c
@@ -105,6 +105,8 @@ static void test_pad_must_be_zero(void)
KVM_ARM_VM_SMCCC_FILTER, &filter);
TEST_ASSERT(r < 0 && errno == EINVAL,
"Setting filter with nonzero padding should return EINVAL");
+
+ kvm_vm_free(vm);
}
/* Ensure that userspace cannot filter the Arm Architecture SMCCC range */
--
2.39.5