qemu-irix/hw/usb
Eric Blake 121829cb21 usb: Fix build with newer gcc
gcc 7 is pickier about our sources:

hw/usb/bus.c: In function ‘usb_port_location’:
hw/usb/bus.c:410:66: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 15 [-Werror=format-truncation=]
         snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
                                                                  ^~
hw/usb/bus.c:410:9: note: ‘snprintf’ output between 3 and 28 bytes into a destination of size 16
         snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  upstream->path, portnr);
                  ~~~~~~~~~~~~~~~~~~~~~~~

But we know that there are at most 5 levels of USB hubs, with at
most two digits per level; that plus the separating dots means we
use at most 15 bytes (including trailing NUL) of our 16-byte field.
Adding an assertion to show gcc that we checked for truncation is
enough to shut up the false-positive warning.

Inspired by an idea by Dr. David Alan Gilbert <dgilbert@redhat.com>.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170717151334.17954-1-eblake@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-07-20 10:02:11 +02:00
..
Makefile.objs
bus.c usb: Fix build with newer gcc 2017-07-20 10:02:11 +02:00
ccid-card-emulated.c
ccid-card-passthru.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
ccid.h
combined-packet.c
core.c
desc-msos.c
desc.c
desc.h
dev-audio.c
dev-bluetooth.c
dev-hid.c
dev-hub.c
dev-mtp.c
dev-network.c
dev-serial.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
dev-smartcard-reader.c Convert error_report() to warn_report() 2017-07-13 13:49:58 +02:00
dev-storage.c
dev-uas.c
dev-wacom.c
hcd-ehci-pci.c
hcd-ehci-sysbus.c
hcd-ehci.c ehci: add sanity check for maxframes 2017-07-17 11:39:08 +02:00
hcd-ehci.h
hcd-musb.c
hcd-ohci.c
hcd-uhci.c vmstate: error hint for failed equal checks 2017-06-28 11:18:44 +02:00
hcd-xhci-nec.c
hcd-xhci.c pci: Fix the wrong assertion. 2017-07-03 22:29:49 +03:00
hcd-xhci.h
host-legacy.c
host-libusb.c usb-host: support devices with sparse/non-sequential USB interfaces 2017-06-21 15:30:08 +02:00
host-stub.c
host.h
libhw.c
quirks-ftdi-ids.h
quirks-pl2303-ids.h
quirks.c
quirks.h
redirect.c * gdbstub fixes (Alex) 2017-07-14 12:16:09 +01:00
trace-events
tusb6010.c
xen-usb.c