From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF3sH-0003rP-B2 for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:34:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SF3s8-0001a3-Gk for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:34:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF3s8-0001ZS-8a for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:34:08 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q33DY5Ud026293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Apr 2012 09:34:05 -0400 Date: Tue, 3 Apr 2012 16:33:59 +0300 From: Alon Levy Message-ID: <20120403133359.GT20067@garlic.redhat.com> References: <1333455707-3534-1-git-send-email-hdegoede@redhat.com> <20120403131602.GQ20067@garlic.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120403131602.GQ20067@garlic.redhat.com> Subject: Re: [Qemu-devel] [PATCH] usb-ehci: Ensure frindex writes leave a valid frindex value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hans de Goede , Gerd Hoffmann , qemu-devel@nongnu.org On Tue, Apr 03, 2012 at 04:16:02PM +0300, Alon Levy wrote: > On Tue, Apr 03, 2012 at 02:21:47PM +0200, Hans de Goede wrote: > > frindex is a 14 bits counter, so bits 31-14 should always be 0, and > > after the commit titled "usb-ehci: frindex always is a 14 bits counter" > > we rely on frindex always being a multiple of 8. I've not seen this in > > practice, but theoretically a guest can write a value >= 0x4000 or a value > > which is not a multiple of 8 value to frindex, this patch ensures that > > things will still work when that happens. > > Acked-by: Alon Levy I meant: Reviewed-by: Alon Levy > > > > > Signed-off-by: Hans de Goede > > --- > > hw/usb/hcd-ehci.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c > > index 64b58e3..8865b4e 100644 > > --- a/hw/usb/hcd-ehci.c > > +++ b/hw/usb/hcd-ehci.c > > @@ -1102,6 +1102,10 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val) > > val &= USBINTR_MASK; > > break; > > > > + case FRINDEX: > > + val &= 0x00003ff8; /* frindex is 14bits and always a multiple of 8 */ > > + break; > > + > > case CONFIGFLAG: > > val &= 0x1; > > if (val) { > > -- > > 1.7.9.3 > > > > >