From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wk8fG-0006Nk-4p for qemu-devel@nongnu.org; Tue, 13 May 2014 05:06:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wk8f9-0006jq-T7 for qemu-devel@nongnu.org; Tue, 13 May 2014 05:06:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wk8f9-0006jl-ME for qemu-devel@nongnu.org; Tue, 13 May 2014 05:06:15 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4D96EYn016954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 13 May 2014 05:06:15 -0400 Date: Tue, 13 May 2014 12:05:07 +0300 From: "Michael S. Tsirkin" Message-ID: <20140513090507.GA29760@redhat.com> References: <1399896829-16617-1-git-send-email-mst@redhat.com> <1399967409.7118.38.camel@nilsson.home.kraxel.org> <20140513083214.GD29442@redhat.com> <1399970685.7118.45.camel@nilsson.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399970685.7118.45.camel@nilsson.home.kraxel.org> Subject: Re: [Qemu-devel] [PATCH] usb: fix up post load checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, dgilbert@redhat.com On Tue, May 13, 2014 at 10:44:45AM +0200, Gerd Hoffmann wrote: > On Di, 2014-05-13 at 11:32 +0300, Michael S. Tsirkin wrote: > > On Tue, May 13, 2014 at 09:50:09AM +0200, Gerd Hoffmann wrote: > > > Hi, > > > > > > > + (dev->setup_state == SETUP_STATE_DATA && > > > > > > Fails to build, SETUP_STATE_DATA is not defined here. > > > > > > I think we can simply drop that check, index should never ever be larger > > > than len, no matter what the state is. > > > > > > cheers, > > > Gerd > > > > I'm confused by usb_generic_async_ctrl_complete which can modify len > > without touching index. > > only in setup state, before any data from/to the buffer is transfered, > so index is still zero at that point. And SETUP_STATE_PARAM? > flow is this: > > state_setup: len = $buflen, index = 0 > state_data: xfer %buf data, increase index up to len while doing so. > state_ack: index == len > state_idle: likewise. > > cheers, > Gerd >