From patchwork Tue Apr 16 10:13:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 236908 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1DB762C0109 for ; Tue, 16 Apr 2013 20:17:05 +1000 (EST) Received: from localhost ([::1]:53403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2wh-0002eo-9y for incoming@patchwork.ozlabs.org; Tue, 16 Apr 2013 06:17:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2t2-00061U-LP for qemu-devel@nongnu.org; Tue, 16 Apr 2013 06:13:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US2t0-0003dy-11 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 06:13:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2sz-0003dN-Pc for qemu-devel@nongnu.org; Tue, 16 Apr 2013 06:13:13 -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 r3GADDei013716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Apr 2013 06:13:13 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3GADCdU024839; Tue, 16 Apr 2013 06:13:12 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id C007240E9D; Tue, 16 Apr 2013 12:13:10 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 16 Apr 2013 12:13:09 +0200 Message-Id: <1366107190-30853-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1366107190-30853-1-git-send-email-kraxel@redhat.com> References: <1366107190-30853-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 6/7] xhci: fix address device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Zero-initialize the set-address dummy USBPacket, also add buffer to avoid sanity checks triggering. https://bugzilla.redhat.com/show_bug.cgi?id=929019 Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index e489059..a26b78e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2139,8 +2139,12 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT; } else { USBPacket p; + uint8_t buf[1]; + slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid; usb_device_reset(dev); + memset(&p, 0, sizeof(p)); + usb_packet_addbuf(&p, buf, sizeof(buf)); usb_packet_setup(&p, USB_TOKEN_OUT, usb_ep_get(dev, USB_TOKEN_OUT, 0), 0, 0, false, false);