linux-stable/drivers/usb
Kees Cook cc5472b517 usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math
[ Upstream commit 0fbd2cda92 ]

Walking the dram->cs array was seen as accesses beyond the first array
item by the compiler. Instead, use the array index directly. This allows
for run-time bounds checking under CONFIG_UBSAN_BOUNDS as well. Seen
with GCC 13 with -fstrict-flex-arrays:

In function 'xhci_mvebu_mbus_config',
    inlined from 'xhci_mvebu_mbus_init_quirk' at ../drivers/usb/host/xhci-mvebu.c:66:2:
../drivers/usb/host/xhci-mvebu.c:37:28: warning: array subscript 0 is outside array bounds of 'const struct mbus_dram_window[0]' [-Warray-bounds=]
   37 |                 writel(((cs->size - 1) & 0xffff0000) | (cs->mbus_attr << 8) |
      |                          ~~^~~~~~

Cc: Mathias Nyman <mathias.nyman@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230204183651.never.663-kees@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-11 13:50:44 +01:00
..
atm usb: move from strlcpy with unused retval to strscpy 2022-08-19 11:08:54 +02:00
c67x00
cdns3 usb: cdns3: remove fetched trb from cache before dequeuing 2023-01-17 16:35:47 +01:00
chipidea USB: chipidea: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
class USB: make devnode() callback in usb_class_driver take a const * 2022-10-20 12:11:56 +02:00
common USB: ULPI: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
core USB: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:39 +01:00
dwc2 usb: dwc2: power on/off phy for peripheral mode in dual-role mode 2022-12-08 16:50:56 +01:00
dwc3 USB: dwc3: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:28:53 +01:00
fotg210 USB: fotg210: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
gadget USB: gadget: pxa27x_udc: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:43 +01:00
host usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math 2023-03-11 13:50:44 +01:00
image usb/image: fix repeated words in comments 2022-07-27 14:33:53 +02:00
isp1760
misc USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100 2023-01-20 15:06:23 +01:00
mon usb: mon: make mmapped memory read only 2022-09-22 15:52:29 +02:00
mtu3 usb: mtu3: fix failed runtime suspend in host only mode 2022-09-30 13:55:48 +02:00
musb usb: musb: mediatek: don't unregister something that wasn't registered 2023-03-10 09:28:53 +01:00
phy usb: isp1301-omap: Convert to i2c's .probe_new() 2022-11-22 17:33:27 +01:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-06-21 16:39:03 +02:00
roles Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
serial USB: serial: option: add support for VW/Skoda "Carstick LTE" 2023-03-03 11:56:17 +01:00
storage usb-storage: apply IGNORE_UAS only for HIKSEMI MD202 on RTL9210 2023-01-17 16:37:04 +01:00
typec usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count 2023-03-10 09:28:49 +01:00
usbip Including fixes from bpf, netfilter and can. 2022-12-21 08:41:32 -08:00
Kconfig usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
Makefile usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
usb-skeleton.c usb: add usb_set_intfdata() documentation 2022-11-29 08:56:09 +01:00