From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com ([74.125.82.47]:51388 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbdJMRtG (ORCPT ); Fri, 13 Oct 2017 13:49:06 -0400 Received: by mail-wm0-f47.google.com with SMTP id f4so23276940wme.0 for ; Fri, 13 Oct 2017 10:49:06 -0700 (PDT) Date: Fri, 13 Oct 2017 19:49:12 +0200 From: Christoffer Dall To: Andrew Jones Cc: Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Eric Auger , Andre Przywara , stable@vger.kernel.org Subject: Re: [PATCH v2] KVM: arm64: its: Fix missing dynamic allocation check in scan_its_table Message-ID: <20171013174912.GB17578@cbox> References: <20171013131734.16485-1-christoffer.dall@linaro.org> <20171013140018.2js6hwctwprunad3@kamzik.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171013140018.2js6hwctwprunad3@kamzik.brq.redhat.com> Sender: stable-owner@vger.kernel.org List-ID: On Fri, Oct 13, 2017 at 04:00:18PM +0200, Andrew Jones wrote: > On Fri, Oct 13, 2017 at 03:17:34PM +0200, Christoffer Dall wrote: > > We currently allocate an entry dynamically, but we never check if the > > allocation actually succeeded. We actually don't need a dynamic > > allocation, because we know the maximum size of an ITS table entry, so > > we can simply use an allocation on the stack. > > > > Cc: > > Signed-off-by: Christoffer Dall > > --- > > virt/kvm/arm/vgic/vgic-its.c | 18 +++++++----------- > > 1 file changed, 7 insertions(+), 11 deletions(-) > > > > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > > index f51c1e1..1d2668b 100644 > > --- a/virt/kvm/arm/vgic/vgic-its.c > > +++ b/virt/kvm/arm/vgic/vgic-its.c > > @@ -1801,37 +1801,33 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry, > > static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz, > > int start_id, entry_fn_t fn, void *opaque) > > { > > - void *entry = kzalloc(esz, GFP_KERNEL); > > struct kvm *kvm = its->dev->kvm; > > unsigned long len = size; > > int id = start_id; > > gpa_t gpa = base; > > + char entry[esz] > > Might want a semicolon here :-) > Duh, yeah, left out the '-a' in my 'git commit --amend'... Thanks! -Christoffer