From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF3au-0002gJ-IC for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:16:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SF3am-0003d9-CM for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:16:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF3am-0003cq-4B for qemu-devel@nongnu.org; Tue, 03 Apr 2012 09:16:12 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q33DGA4F029136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Apr 2012 09:16:10 -0400 Date: Tue, 3 Apr 2012 16:16:02 +0300 From: Alon Levy Message-ID: <20120403131602.GQ20067@garlic.redhat.com> References: <1333455707-3534-1-git-send-email-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1333455707-3534-1-git-send-email-hdegoede@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 Cc: Gerd Hoffmann , qemu-devel@nongnu.org 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 > > 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 > >