Skip to contentSkip to conversation

net: stmmac: tegra: Properly allocate clock bulk data

PATCH Applied Thierry Reding 3 participants 3 messages Jul 26, 2023 – Jul 29, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: tegra: Properly allocate clock bulk data

From: Thierry Reding <[email protected]>

The clock data is an array of struct clk_bulk_data, so make sure to allocate enough memory.

Fixes d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +2 -1
index 99e2e5a5cd60..78a492b91bc6 100644
@@ -234,7 +234,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	res.addr = mgbe->regs;
 	res.irq = irq;
 
-	mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL);
+	mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks),
+				  sizeof(*mgbe->clks), GFP_KERNEL);
 	if (!mgbe->clks)
 		return -ENOMEM;
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Thierry Reding

From: Thierry Reding <[email protected]>

+ Revanth Kumar Uppala <[email protected]>,
Bhadram Varka <[email protected]>,
Maxime Coquelin <[email protected]>,
[email protected],
[email protected]

As per the output of
./scripts/get_maintainer.pl --git-min-percent 25 this.patch which is the preferred method to determine the CC list for Networking patches.

Quoted 5 lines

The clock data is an array of struct clk_bulk_data, so make sure to allocate enough memory.

Fixes d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
Quoted 22 lines
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +2 -1
index 99e2e5a5cd60..78a492b91bc6 100644
@@ -234,7 +234,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	res.addr = mgbe->regs;
 	res.irq = irq;
 
-	mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL);
+	mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks),
+				  sizeof(*mgbe->clks), GFP_KERNEL);
 	if (!mgbe->clks)
 		return -ENOMEM;
 
Signature · 1 line
2.41.0
#2 lore raw
In reply to Thierry Reding
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 9 lines · On Wed, 26 Jul 2023 18:32:00 +0200 you wrote:

From: Thierry Reding <[email protected]>

The clock data is an array of struct clk_bulk_data, so make sure to allocate enough memory.

Fixes d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")

[...]

Here is the summary with links:
- net: stmmac: tegra: Properly allocate clock bulk data

    https://git.kernel.org/netdev/net/c/a0b1b2055be3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html