Re: [PATCH v5 3/7] kvm: Make init_rmode_identity_map() return 0 on success.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/11/2014 05:17 PM, Paolo Bonzini wrote:
......
@@ -7645,7 +7642,7 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
  			kvm->arch.ept_identity_map_addr =
  				VMX_EPT_IDENTITY_PAGETABLE_ADDR;
  		err = -ENOMEM;
-		if (!init_rmode_identity_map(kvm))
+		if (init_rmode_identity_map(kvm))
Please add "< 0" here.  I would also consider setting err to the return
value of init_rmode_identity_map, and initializing it to -ENOMEM only
after the "if".

I'd like to move err = -ENOMEM to the following place:

vmx_create_vcpu()
{
    ......
    err = kvm_vcpu_init(&vmx->vcpu, kvm, id);
    if (err)
        goto free_vcpu;

    err = -ENOMEM;              ---------------------- move it here

    vmx->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
    ....
    vmx->loaded_vmcs->vmcs = alloc_vmcs();
    ....
}

So that it can be used to handle the next two memory allocation error.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux