net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
Subsystems (3)
PATCH 1/1 net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
From: Arnd Bergmann <[email protected]>
The pd692x0_manager array in this function is really too big to fit on the stack, though this never triggered a warning until a recent patch made it slightly bigger:
drivers/net/pse-pd/pd692x0.c: In function 'pd692x0_setup_pi_matrix':drivers/net/pse-pd/pd692x0.c:1210:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
Change the function to dynamically allocate the array here.
--- drivers/net/pse-pd/pd692x0.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/pse-pd/pd692x0.c +6 -2
@@ -860,7 +860,7 @@ pd692x0_of_get_ports_manager(struct pd692x0_priv *priv,static int pd692x0_of_get_managers (struct pd692x0_priv *priv, -struct pd692x0_manager manager[PD692X0_MAX_MANAGERS ]) +struct pd692x0_manager *manager) {struct device_node *managers_node, *node;int ret, nmanagers, i, j;
@@ -1164,7 +1164,7 @@ pd692x0_write_ports_matrix(struct pd692x0_priv *priv,static int pd692x0_setup_pi_matrix (struct pse_controller_dev *pcdev) { -struct pd692x0_manager manager[PD692X0_MAX_MANAGERS ] = {0 }; + struct pd692x0_manager *manager __free(kfree) = NULL;struct pd692x0_priv *priv =to_pd692x0_priv (pcdev);struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS ];int ret, i, j, nmanagers;
@@ -1174,6 +1174,10 @@ static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) priv->fw_state != PD692X0_FW_COMPLETE)return 0 ; + manager =kcalloc (PD692X0_MAX_MANAGERS ,sizeof (*manager),GFP_KERNEL ); +if (!manager) +return -ENOMEM ; + ret =pd692x0_of_get_managers (priv, manager);if (ret <0 )return ret;
Signature · 1 line
2.39.5
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
pd692x0_managerarray in this function is really too big to fit on the stack, though this never triggered a warning until a recent patch made it slightly bigger:
drivers/net/pse-pd/pd692x0.c: In function 'pd692x0_setup_pi_matrix':drivers/net/pse-pd/pd692x0.c:1210:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]Change the function to dynamically allocate the array here.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Wed, 9 Jul 2025 17:32:04 +0200 you wrote:
From: Arnd Bergmann <[email protected]>
The
pd692x0_managerarray in this function is really too big to fit on the stack, though this never triggered a warning until a recent patch made it slightly bigger:
drivers/net/pse-pd/pd692x0.c: In function 'pd692x0_setup_pi_matrix':drivers/net/pse-pd/pd692x0.c:1210:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=][...]
Here is the summary with links:
- net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
https://git.kernel.org/netdev/net-next/c/d12b3dc10609
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html