Skip to content

Commit 2192d34

Browse files
Zenghui YuMarc Zyngier
authored andcommitted
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: Zenghui Yu <zenghui.yu@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent c35dd83 commit 2192d34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static void setup_vm(void)
331331
{
332332
int i;
333333

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

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

0 commit comments

Comments
 (0)