[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PULL 2/8] usb: correctly handle Zero Length Packets
From: |
Gerd Hoffmann |
Subject: |
[Qemu-arm] [PULL 2/8] usb: correctly handle Zero Length Packets |
Date: |
Tue, 12 Jun 2018 12:44:24 +0200 |
From: Philippe Mathieu-Daudé <address@hidden>
USB Specification Revision 2.0, §5.5.3:
The Data stage of a control transfer from an endpoint to the host is complete
when the endpoint does one of the following:
• Has transferred exactly the amount of data specified during the Setup stage
• 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é <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
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 *dev,
USBPacket *p,
usbredirparser_peer_has_cap(dev->parser,
usb_redir_cap_32bits_bulk_length));
- if (ep & USB_DIR_IN) {
+ if (ep & USB_DIR_IN || size == 0) {
usbredirparser_send_bulk_packet(dev->parser, p->id,
&bulk_packet, NULL, 0);
} else {
--
2.9.3
- [Qemu-arm] [PULL 0/8] Usb 20180612 patches, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 7/8] usb-hcd-xhci-test: add a test for ccid hotplug, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 8/8] usb-mtp: Return error on suspicious TYPE_DATA packet from initiator, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 6/8] usb-ccid: fix bus leak, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 1/8] usb: update docs, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 2/8] usb: correctly handle Zero Length Packets,
Gerd Hoffmann <=
- [Qemu-arm] [PULL 3/8] usb/dev-mtp: Fix use of uninitialized values, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 4/8] bus: do not unref the added child bus on realize, Gerd Hoffmann, 2018/06/12
- [Qemu-arm] [PULL 5/8] object: fix OBJ_PROP_LINK_UNREF_ON_RELEASE ambivalence, Gerd Hoffmann, 2018/06/12
- Re: [Qemu-arm] [PULL 0/8] Usb 20180612 patches, Peter Maydell, 2018/06/12