aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e289486edc6d..a6e612fced73 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2591,13 +2591,12 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
2591 int i, r; 2591 int i, r;
2592 struct kvm_io_bus *new_bus, *bus; 2592 struct kvm_io_bus *new_bus, *bus;
2593 2593
2594 new_bus = kzalloc(sizeof(struct kvm_io_bus), GFP_KERNEL); 2594 bus = kvm->buses[bus_idx];
2595
2596 new_bus = kmemdup(bus, sizeof(*bus), GFP_KERNEL);
2595 if (!new_bus) 2597 if (!new_bus)
2596 return -ENOMEM; 2598 return -ENOMEM;
2597 2599
2598 bus = kvm->buses[bus_idx];
2599 memcpy(new_bus, bus, sizeof(struct kvm_io_bus));
2600
2601 r = -ENOENT; 2600 r = -ENOENT;
2602 for (i = 0; i < new_bus->dev_count; i++) 2601 for (i = 0; i < new_bus->dev_count; i++)
2603 if (new_bus->range[i].dev == dev) { 2602 if (new_bus->range[i].dev == dev) {