Skip to content

Commit 0f9f5ee

Browse files
aloktiwaUlrich Hecht
authored andcommitted
PCI: tegra: Fix devm_kcalloc() argument order for port->phys allocation
[ Upstream commit e1a8805e5d263453ad76a4f50ab3b1c18ea07560 ] Fix incorrect argument order in devm_kcalloc() when allocating port->phys. The original call used sizeof(phy) as the number of elements and port->lanes as the element size, which is reversed. While this happens to produce the correct total allocation size with current pointer size and lane counts, the argument order is wrong. Fixes: 6fe7c18 ("PCI: tegra: Support per-lane PHYs") Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com> [mani: added Fixes tag] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20250819150436.3105973-1-alok.a.tiwari@oracle.com Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent fe4b9cf commit 0f9f5ee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/pci/controller/pci-tegra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ static int tegra_pcie_port_get_phys(struct tegra_pcie_port *port)
11891189
unsigned int i;
11901190
int err;
11911191

1192-
port->phys = devm_kcalloc(dev, sizeof(phy), port->lanes, GFP_KERNEL);
1192+
port->phys = devm_kcalloc(dev, port->lanes, sizeof(phy), GFP_KERNEL);
11931193
if (!port->phys)
11941194
return -ENOMEM;
11951195

0 commit comments

Comments
 (0)