[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <541178E1.3080503@cn.fujitsu.com>
Date: Thu, 11 Sep 2014 18:26:41 +0800
From: tangchen <tangchen@...fujitsu.com>
To: Paolo Bonzini <pbonzini@...hat.com>, <gleb@...nel.org>,
<mtosatti@...hat.com>, <nadav.amit@...il.com>, <jan.kiszka@....de>
CC: <kvm@...r.kernel.org>, <laijs@...fujitsu.com>,
<isimatu.yasuaki@...fujitsu.com>, <guz.fnst@...fujitsu.com>,
<linux-kernel@...r.kernel.org>, <tangchen@...fujitsu.com>
Subject: Re: [PATCH v5 3/7] kvm: Make init_rmode_identity_map() return 0 on
success.
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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists