u-boot-brain/drivers/usb
Stefan Brüns 56a7bbd741 usb: dwc2: Fix out-of-bounds access, fix chunk size
Fix two errors in transfer len calculation, move loop invariant code out
of loop.

If xfer_len is equal to CONFIG_DWC2_MAX_TRANSFER_SIZE (or slightly
smaller), the xfer_len will be to large, e.g.:
  xfer_len = MAX_TRANSFER_SIZE = 65535
  max packet size = 512
    => num_packets = 128
    => IN xfer_len = 65536

For OUT transactions larger than (65536 - mps) bytes, the xfer_len
determination is quite awkward, it is only correct due to:
- max_packet_size for control/bulk/interrupt is required to be
  power-of-two.
- (CONFIG_DWC2_MAX_TRANSFER_SIZE + 1) % max-packet-size is zero
  for all allowed (2^3 ... 2^9) packet sizes

As the max xfer len is loop invariant, it can be moved out of the loop.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-01-23 16:21:10 +01:00
..
dwc3 usb: dwc3: fix build warnings 2015-12-07 00:14:59 +01:00
emul usb: sandbox: Add a USB emulation driver 2015-11-19 20:27:52 -07:00
eth dm: net: usb: Convert mcs7830 driver to support driver model 2016-01-12 10:19:09 -07:00
gadget Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
host usb: dwc2: Fix out-of-bounds access, fix chunk size 2016-01-23 16:21:10 +01:00
musb Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
musb-new Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
phy usb: xhci: omap: Remove common dwc3 drv functions calls 2015-07-22 08:55:44 +02:00
ulpi Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
Kconfig usb: musb-new: Kconfig support for USB_MUSB_HOST and USB_MUSB_GADGET 2015-08-05 17:20:34 +02:00