diff mbox series

[v3,5/7] KVM: x86: Use kcalloc to allocate the mce_banks array.

Message ID 20220513182038.2564643-6-juew@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Add CMCI and UCNA emulation | expand

Commit Message

Jue Wang May 13, 2022, 6:20 p.m. UTC
Update the array allocations to use the array allocation API: kcalloc.
This sets up pattern for future array allocations, e.g., mci_ctl2_banks.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Jue Wang <juew@google.com>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index eb4029660bd9..2eaa6161b227 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11126,7 +11126,7 @@  int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
 		goto fail_free_lapic;
 	vcpu->arch.pio_data = page_address(page);
 
-	vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4,
+	vcpu->arch.mce_banks = kcalloc(KVM_MAX_MCE_BANKS * 4, sizeof(u64),
 				       GFP_KERNEL_ACCOUNT);
 	if (!vcpu->arch.mce_banks)
 		goto fail_free_pio_data;