linux-next/drivers/usb/chipidea
Xu Yang 990c2a26f7 usb: chipidea: host: Improve port index sanitizing
Coverity from Synopsys complains "Illegal address computation (OVERRUN)"
on status_reg.

After below code executed,

  port_index = wIndex & 0xff;
  port_index -= (port_index > 0);

the static analysis tool see the value of port_index is now between 0 and
254 (inclusive).

However, ehci_def.h define port_status as below:

  #define HCS_N_PORTS_MAX         15
  u32     port_status[HCS_N_PORTS_MAX];

So the tool think illegal array pointer may be obtained.

  status_reg = &ehci->regs->port_status[port_index];

This will follow "846cbf98cbef USB: EHCI: Improve port index sanitizing" to
improve port index sanitizing.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20241202083453.704533-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-04 16:11:58 +01:00
..
bits.h USB: chipidea: Use the correct style for SPDX License Identifier 2020-03-16 11:13:47 +08:00
ci_hdrc_imx.c usb: chipidea: add CI_HDRC_HAS_SHORT_PKT_LIMIT flag 2024-10-04 15:13:58 +02:00
ci_hdrc_imx.h usb: chipidea: imx: add one fsl picophy parameter tuning implementation 2023-07-25 18:21:52 +02:00
ci_hdrc_msm.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_npcm.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_pci.c usb: chipidea: ci_hdrc_pci: Fix improper use of kerneldoc format 2020-07-09 17:19:56 +02:00
ci_hdrc_tegra.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_usb2.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci.h usb: chipidea: udc: limit usb request length to max 16KB 2024-10-04 15:13:58 +02:00
core.c usb: Use (of|device)_property_present() for non-boolean properties 2024-11-05 13:29:26 +01:00
debug.c usb: chipidea: debug: remove redundant 'role' debug file 2023-03-23 17:27:46 +01:00
host.c usb: chipidea: host: Improve port index sanitizing 2024-12-04 16:11:58 +01:00
host.h usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined 2020-01-22 07:54:27 +01:00
Kconfig usb: chipidea: Add support for NPCM 2023-10-21 12:46:00 +02:00
Makefile usb: chipidea: Add support for NPCM 2023-10-21 12:46:00 +02:00
otg_fsm.c usb: chipidea: fix deadlock in ci_otg_del_timer 2022-11-09 12:34:18 +01:00
otg_fsm.h USB: chipidea: Use the correct style for SPDX License Identifier 2020-03-16 11:13:47 +08:00
otg.c usb: chipidea: add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag 2023-10-21 12:45:45 +02:00
otg.h usb: chipidea: core: add controller resume support when controller is powered off 2022-10-23 14:34:53 +02:00
trace.c usb: chipidea: add tracepoint support for udc 2020-12-10 08:45:26 +08:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
udc.c usb: chipidea: udc: improve error recovery for ISO transfer 2024-10-04 15:14:09 +02:00
udc.h usb: chipidea: udc: create bounce buffer for problem sglist entries if possible 2024-10-04 15:13:58 +02:00
ulpi.c Revert "usb: chipidea: move ci_ulpi_init after the phy initialization" 2024-06-04 14:51:09 +02:00
usbmisc_imx.c usb: chipidea: imx: add imx8ulp support 2024-11-12 12:15:04 +01:00