From nobody Tue Feb 10 09:02:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528800488315977.8988176507572; Tue, 12 Jun 2018 03:48:08 -0700 (PDT) Received: from localhost ([::1]:54400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSgqN-00053x-Hq for importer@patchew.org; Tue, 12 Jun 2018 06:48:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSgn2-0002pr-Ri for qemu-devel@nongnu.org; Tue, 12 Jun 2018 06:44:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSgn2-0007xc-2V for qemu-devel@nongnu.org; Tue, 12 Jun 2018 06:44:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37708 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSgmz-0007vD-0S; Tue, 12 Jun 2018 06:44:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6501A818BAF4; Tue, 12 Jun 2018 10:44:36 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-109.ams2.redhat.com [10.36.116.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AC6210193; Tue, 12 Jun 2018 10:44:31 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8065724EF0D; Tue, 12 Jun 2018 12:44:30 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 12:44:24 +0200 Message-Id: <20180612104430.25745-3-kraxel@redhat.com> In-Reply-To: <20180612104430.25745-1-kraxel@redhat.com> References: <20180612104430.25745-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 12 Jun 2018 10:44:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 12 Jun 2018 10:44:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/8] usb: correctly handle Zero Length Packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , Peter Maydell , Alistair Francis , Eduardo Habkost , Li Zhijian , Peter Crosthwaite , Jason Wang , Zhang Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, "Michael S. Tsirkin" , Gerd Hoffmann , "Edgar E. Iglesias" , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 USB Specification Revision 2.0, =C2=A75.5.3: The Data stage of a control transfer from an endpoint to the host is comp= lete when the endpoint does one of the following: =E2=80=A2 Has transferred exactly the amount of data specified during the= Setup stage =E2=80=A2 Transfers a packet with a payload size less than wMaxPacketSize= or transfers a zero-length packet" hw/usb/redirect.c:802:9: warning: Declared variable-length array (VLA) has = zero size uint8_t buf[size]; ^~~~~~~~~~~ ~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180604151421.23385-2-f4bug@amsat.org Signed-off-by: Gerd Hoffmann --- hw/usb/redirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 65a9196c1a..58e8f7f5bd 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -795,7 +795,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *d= ev, USBPacket *p, usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_32bits_bulk_length)); =20 - if (ep & USB_DIR_IN) { + if (ep & USB_DIR_IN || size =3D=3D 0) { usbredirparser_send_bulk_packet(dev->parser, p->id, &bulk_packet, NULL, 0); } else { --=20 2.9.3