Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234035

[FYI PATCH 10/20] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject [FYI PATCH 10/20] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister
Date 2015-09-28 12:50 +0200
Message-ID <qdEam-3iu-15@gated-at.bofh.it> (permalink)
References <qdE0F-37c-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jason Wang <jasowang@redhat.com>

All fields of kvm_io_range were initialized or copied explicitly
afterwards. So switch to use kmalloc().

Cc: Gleb Natapov <gleb@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 8db1d9361993..23116dcb2129 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3341,7 +3341,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	if (bus->dev_count - bus->ioeventfd_count > NR_IOBUS_DEVS - 1)
 		return -ENOSPC;
 
-	new_bus = kzalloc(sizeof(*bus) + ((bus->dev_count + 1) *
+	new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count + 1) *
 			  sizeof(struct kvm_io_range)), GFP_KERNEL);
 	if (!new_bus)
 		return -ENOMEM;
@@ -3373,7 +3373,7 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
 	if (r)
 		return r;
 
-	new_bus = kzalloc(sizeof(*bus) + ((bus->dev_count - 1) *
+	new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) *
 			  sizeof(struct kvm_io_range)), GFP_KERNEL);
 	if (!new_bus)
 		return -ENOMEM;
-- 
1.8.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[FYI PATCH 00/20] kvm/queue will be merged soon to kvm/next Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:40 +0200
  [FYI PATCH 03/20] KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:40 +0200
  [FYI PATCH 15/20] kvm/x86: Hyper-V HV_X64_MSR_VP_RUNTIME support Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:40 +0200
  [FYI PATCH 12/20] kvm: add capability for any-length ioeventfds Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:40 +0200
  [FYI PATCH 20/20] KVM: vmx: disable posted interrupts if no local APIC Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 04/20] KVM: x86: introduce lapic_in_kernel Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 11/20] kvm: add tracepoint for fast mmio Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 17/20] KVM: VMX: introduce __vmx_flush_tlb to handle specific vpid Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 09/20] KVM: x86: Add support for local interrupt requests from userspace Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 10/20] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 19/20] KVM: nVMX: nested VPID emulation Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 18/20] KVM: nVMX: emulate the INVVPID instruction Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 06/20] KVM: x86: Split the APIC from the rest of IRQCHIP. Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 07/20] KVM: x86: Add KVM exit for IOAPIC EOIs Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 05/20] KVM: x86: unify handling of interrupt window Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 13/20] kvm/x86: Hyper-V HV_X64_MSR_RESET msr Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 14/20] kvm/x86: Hyper-V HV_X64_MSR_VP_INDEX export for QEMU. Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 02/20] KVM: x86: store IOAPIC-handled vectors in each VCPU Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200
  [FYI PATCH 01/20] KVM: x86: set TMR when the interrupt is accepted Paolo Bonzini <pbonzini@redhat.com> - 2015-09-28 12:50 +0200

csiph-web