* [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
@ 2025-07-09 15:32 Arnd Bergmann
2025-07-09 22:07 ` Kory Maincent
2025-07-11 1:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2025-07-09 15:32 UTC (permalink / raw)
To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Arnd Bergmann, Colin Ian King, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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.
Fixes: 359754013e6a ("net: pse-pd: pd692x0: Add support for PSE PI priority feature")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/pse-pd/pd692x0.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c
index 4de004813560..399ce9febda4 100644
--- a/drivers/net/pse-pd/pd692x0.c
+++ b/drivers/net/pse-pd/pd692x0.c
@@ -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;
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
2025-07-09 15:32 [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix Arnd Bergmann
@ 2025-07-09 22:07 ` Kory Maincent
2025-07-11 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Kory Maincent @ 2025-07-09 22:07 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Arnd Bergmann, Colin Ian King,
netdev, linux-kernel
Le Wed, 9 Jul 2025 17:32:04 +0200,
Arnd Bergmann <arnd@kernel.org> a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Thank you!
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix
2025-07-09 15:32 [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix Arnd Bergmann
2025-07-09 22:07 ` Kory Maincent
@ 2025-07-11 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-11 1:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: o.rempel, kory.maincent, andrew+netdev, davem, edumazet, kuba,
pabeni, arnd, colin.i.king, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 9 Jul 2025 17:32:04 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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=]
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-11 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 15:32 [PATCH] net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix Arnd Bergmann
2025-07-09 22:07 ` Kory Maincent
2025-07-11 1:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).