From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [PATCH 2/4] ARM: KVM: vgic: fix GICD_ICFGRn access Date: Thu, 29 Aug 2013 13:28:07 -0700 Message-ID: <20130829202807.GI9215@cbox> References: <1377770905-9937-1-git-send-email-marc.zyngier@arm.com> <1377770905-9937-3-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: pbonzini@redhat.com, gleb@redhat.com, "Zhaobo (Bob, ERC)" , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org To: Marc Zyngier Return-path: Received: from mail-pd0-f171.google.com ([209.85.192.171]:62965 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356Ab3H2U2I (ORCPT ); Thu, 29 Aug 2013 16:28:08 -0400 Received: by mail-pd0-f171.google.com with SMTP id g10so912402pdj.16 for ; Thu, 29 Aug 2013 13:28:08 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1377770905-9937-3-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Aug 29, 2013 at 11:08:23AM +0100, Marc Zyngier wrote: > All the code in handle_mmio_cfg_reg() assumes the offset has > been shifted right to accomodate for the 2:1 bit compression, > but this is only done when getting the register addess. address > > Shift the offset early so the code works mostly unchanged. > > Reported-by: Zhaobo (Bob, ERC) > Signed-off-by: Marc Zyngier > --- > virt/kvm/arm/vgic.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c > index a2d478a..902789f 100644 > --- a/virt/kvm/arm/vgic.c > +++ b/virt/kvm/arm/vgic.c > @@ -541,8 +541,12 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu, > struct kvm_exit_mmio *mmio, phys_addr_t offset) > { > u32 val; > - u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, > - vcpu->vcpu_id, offset >> 1); > + u32 *reg; > + > + offset >>= 1; > + reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, > + vcpu->vcpu_id, offset); > + > if (offset & 2) > val = *reg >> 16; > else > -- > 1.8.2.3 > > > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm