]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI: dwc: Use pcie_get_link_speed() helper for safe array access
authorHans Zhang <18255117159@163.com>
Fri, 13 Mar 2026 16:55:19 +0000 (00:55 +0800)
committerManivannan Sadhasivam <mani@kernel.org>
Thu, 26 Mar 2026 18:31:31 +0000 (00:01 +0530)
commit0f34f647f19465b475b13e889dcb33526e166d24
tree10de89655bdeee2c59af33e67d92991c98fa4fa4
parent28d20b0d895849ce3fe8c6f77baffc08886c2157
PCI: dwc: Use pcie_get_link_speed() helper for safe array access

Replace direct indexing of pcie_link_speed[] with the new helper
pcie_get_link_speed() in all DesignWare core and glue drivers. This
ensures that out-of-range generation numbers do not cause out-of-bounds
accesses when the helper returns PCI_SPEED_UNKNOWN, and prepares for
the removal of the range check in of_pci_get_max_link_speed().

The actual validation of the "max-link-speed" DT property (e.g., fallback
to a safe default and warning) is added in subsequent patches for each
driver that reads the property.

Signed-off-by: Hans Zhang <18255117159@163.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20260313165522.123518-3-18255117159@163.com
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-designware.c
drivers/pci/controller/dwc/pcie-qcom-common.c
drivers/pci/controller/dwc/pcie-qcom-ep.c
drivers/pci/controller/dwc/pcie-qcom.c
drivers/pci/controller/dwc/pcie-tegra194.c