Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: pse-pd: pd692x0: reduce stack usage in pd692x0_setup_pi_matrix

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>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20250709153210.1920125-1-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Arnd Bergmann and committed by
Jakub Kicinski
d12b3dc1 acd7c710

+6 -2
+6 -2
drivers/net/pse-pd/pd692x0.c
··· 860 860 861 861 static int 862 862 pd692x0_of_get_managers(struct pd692x0_priv *priv, 863 - struct pd692x0_manager manager[PD692X0_MAX_MANAGERS]) 863 + struct pd692x0_manager *manager) 864 864 { 865 865 struct device_node *managers_node, *node; 866 866 int ret, nmanagers, i, j; ··· 1164 1164 1165 1165 static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) 1166 1166 { 1167 - struct pd692x0_manager manager[PD692X0_MAX_MANAGERS] = {0}; 1167 + struct pd692x0_manager *manager __free(kfree) = NULL; 1168 1168 struct pd692x0_priv *priv = to_pd692x0_priv(pcdev); 1169 1169 struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS]; 1170 1170 int ret, i, j, nmanagers; ··· 1173 1173 if (priv->fw_state != PD692X0_FW_OK && 1174 1174 priv->fw_state != PD692X0_FW_COMPLETE) 1175 1175 return 0; 1176 + 1177 + manager = kcalloc(PD692X0_MAX_MANAGERS, sizeof(*manager), GFP_KERNEL); 1178 + if (!manager) 1179 + return -ENOMEM; 1176 1180 1177 1181 ret = pd692x0_of_get_managers(priv, manager); 1178 1182 if (ret < 0)