qemu-e2k/hw/usb
Peter Maydell f8324611c1 hw/usb/hcd-xhci: Avoid variable-length array in xhci_get_port_bandwidth()
In xhci_get_port_bandwidth(), we use a variable-length array to
construct the buffer to send back to the guest. Avoid the VLA
by using dma_memory_set() to directly request the memory system
to fill the guest memory with a string of '80's.

The codebase has very few VLAs, and if we can get rid of them all we
can make the compiler error on new additions.  This is a defensive
measure against security bugs where an on-stack dynamic allocation
isn't correctly size-checked (e.g.  CVE-2021-3527).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230824164818.2652452-1-peter.maydell@linaro.org>
2023-08-31 19:47:43 +02:00
..
bus.c
canokey.c
canokey.h
ccid-card-emulated.c
ccid-card-passthru.c
ccid.h
chipidea.c
combined-packet.c
core.c
desc-msos.c
desc.c
desc.h
dev-audio.c
dev-hid.c
dev-hub.c
dev-mtp.c
dev-network.c
dev-serial.c
dev-smartcard-reader.c
dev-storage-bot.c
dev-storage-classic.c
dev-storage.c
dev-uas.c
dev-wacom.c
hcd-dwc2.c
hcd-dwc2.h
hcd-dwc3.c
hcd-ehci-pci.c
hcd-ehci-sysbus.c
hcd-ehci.c
hcd-ehci.h
hcd-musb.c
hcd-ohci-pci.c
hcd-ohci.c
hcd-ohci.h
hcd-uhci.c
hcd-uhci.h
hcd-xhci-nec.c
hcd-xhci-pci.c
hcd-xhci-pci.h
hcd-xhci-sysbus.c
hcd-xhci-sysbus.h
hcd-xhci.c hw/usb/hcd-xhci: Avoid variable-length array in xhci_get_port_bandwidth() 2023-08-31 19:47:43 +02:00
hcd-xhci.h
host-libusb.c
host.h
imx-usb-phy.c
Kconfig
libhw.c
meson.build
pcap.c
quirks-ftdi-ids.h
quirks-pl2303-ids.h
quirks.c
quirks.h
redirect.c
trace-events
trace.h
tusb6010.c
u2f-emulated.c
u2f-passthru.c
u2f.c
u2f.h
vt82c686-uhci-pci.c
xen-usb.c
xlnx-usb-subsystem.c
xlnx-versal-usb2-ctrl-regs.c