Commit 2192d348 authored by Zenghui Yu's avatar Zenghui Yu Committed by Marc Zyngier
Browse files

KVM: arm64: selftests: Allocate vcpus with correct size



vcpus array contains pointers to struct kvm_vcpu {}. It is way overkill
to allocate the array with (nr_cpus * sizeof(struct kvm_vcpu)). Fix the
allocation by using the correct size.

Signed-off-by: default avatarZenghui Yu <zenghui.yu@linux.dev>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent c35dd838
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ static void setup_vm(void)
{
	int i;

	vcpus = malloc(test_data.nr_cpus * sizeof(struct kvm_vcpu));
	vcpus = malloc(test_data.nr_cpus * sizeof(struct kvm_vcpu *));
	TEST_ASSERT(vcpus, "Failed to allocate vCPU array");

	vm = vm_create_with_vcpus(test_data.nr_cpus, guest_code, vcpus);