From nobody Thu Oct 30 16:32:08 2025 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; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500921436297328.6166990511789; Mon, 24 Jul 2017 11:37:16 -0700 (PDT) Received: from localhost ([::1]:56355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZiEE-0007EU-SS for importer@patchew.org; Mon, 24 Jul 2017 14:37:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZi6B-0000Sx-4X for qemu-devel@nongnu.org; Mon, 24 Jul 2017 14:28:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZi6A-0004yB-9K for qemu-devel@nongnu.org; Mon, 24 Jul 2017 14:28:55 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:38092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZi6A-0004xp-51; Mon, 24 Jul 2017 14:28:54 -0400 Received: by mail-qk0-x242.google.com with SMTP id t2so10677854qkc.5; Mon, 24 Jul 2017 11:28:54 -0700 (PDT) Received: from yoga.offpageads.com ([138.117.48.223]) by smtp.gmail.com with ESMTPSA id t57sm9033799qtt.18.2017.07.24.11.28.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jul 2017 11:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pH/WInsFUCmdsdj7T+VRO9OJJrleVPwyIwIK4KP7U10=; b=rYGPJsqpJ0wvjbdxYFrj9b7ZuQoo2OG5iZDhm/Rka3+7G/s1nNs3l+UWHRpBoIhwpc W0fMDIdex7NgMKaNVP08PrpkTYeTJ9DJRd7/luVMTbF0zcbCy71a6vRD3t+M+A5gV76x oOiiOTgwWimFlPOVFv9137l7AyyXwh17CB6ttE1J0cNRJvzV8RdzDQ3B0QDBaGgxrfKJ BDSruSlsz5xSDgHZSBnmfEDFn9AhuYbXLE1wFmdiFU5axsxPfSrozqkVunNgs7lAQPcw PVSFs5itQXlobuyNCzDaHMd73krxp3ldjhbA2lUu4qbQbnUppy2sL7kZfKai2MApgE4e IxMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pH/WInsFUCmdsdj7T+VRO9OJJrleVPwyIwIK4KP7U10=; b=LbDyHnYV9i/OB9fqM9SKJ/oNeAW8sqJRhESJorsL1kA4w8e7Ksv9lxfWHHyFcCCsZR 9OJU8sz9v8npYuEnZFzNjlayrPAef23M+Sv5tJCA0vdVWDLnv08pdoNseL8uivnUeSnB KcS/GA2oB78bDxwneANaHp3DDbzkokfUyed1xkUqitZ8tMUFd8eZPmz08is/cTlGfrI6 fSKasBt5d/rEuQhUw2XKTUlGgqBPIQinJGzHL6j1+CqZhkAVeD8ZtnrE/TP3eDXPyT7z 1c26fSzBJfW5cd212eJRF6DHlgTeV1xYM+EpewCbMdZE/5YIgTQpF0EHbh4YzuMaoV9i AADQ== X-Gm-Message-State: AIVw110uNQwIlPF8s/UQJT0TrutAHvkikvxnhUFdOmZtOtyo3hKwJboG jwhWGjwU5HNV9Y6MWPJwVQ== X-Received: by 10.55.43.144 with SMTP id r16mr20731626qkr.59.1500920933701; Mon, 24 Jul 2017 11:28:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Date: Mon, 24 Jul 2017 15:27:31 -0300 Message-Id: <20170724182751.18261-16-f4bug@amsat.org> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170724182751.18261-1-f4bug@amsat.org> References: <20170724182751.18261-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH for 2.10 15/35] 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: qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 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 --- 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 5e42730449..5b7073d2cd 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.13.3