KVM: arm64: selftests: Allocate vcpus with correct size
PATCH 1/1 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 <[email protected]>
--- tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c +1 -1
@@ -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);
Signature · 1 line
2.34.1
Quoted 5 lines · Zenghui Yu
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.
Applied to fixes, thanks!
[1/1] KVM: arm64: selftests: Allocate vcpus with correct size
commit: 2192d348c0aa0cc2e7249dc3709f21bfe0a0170c
Cheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.