From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v3] KVM: remove buggy vcpu id check on vcpu creation Date: Wed, 20 Apr 2016 19:27:06 +0200 Message-ID: <20160420172706.GA4044@potion> References: <146116689259.20666.15860134511726195550.stgit@bahia.huguette.org> <20160420170209.GA11071@potion> <20160420170924.GA7859@jhogan-linux.le.imgtec.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Greg Kurz , Paolo Bonzini , mingo@redhat.com, linux-mips@linux-mips.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, qemu-ppc@nongnu.org, Cornelia Huck , Paul Mackerras , David Gibson To: James Hogan Return-path: Content-Disposition: inline In-Reply-To: <20160420170924.GA7859@jhogan-linux.le.imgtec.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2016-04-20 18:09+0100, James Hogan: > On Wed, Apr 20, 2016 at 07:02:10PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99= wrote: >> 2016-04-20 17:44+0200, Greg Kurz: >> > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c >> > index 70ef1a43c114..0278ea146db5 100644 >> > --- a/arch/mips/kvm/mips.c >> > +++ b/arch/mips/kvm/mips.c >> > @@ -248,9 +248,14 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct = kvm *kvm, unsigned int id) >> > int err, size, offset; >> > void *gebase; >> > int i; >> > + struct kvm_vcpu *vcpu; >> > =20 >> > - struct kvm_vcpu *vcpu =3D kzalloc(sizeof(struct kvm_vcpu), GFP_K= ERNEL); >> > + if (id >=3D KVM_MAX_VCPUS) { >> > + err =3D -EINVAL; >> > + goto out; >>=20 >> 'vcpu' looks undefined at this point, so kfree in 'out:' may bug. >=20 > Thats out_free_cpu I think? My bad, it is. Thank you!