* [PATCH iwl-next v3] ice: remove excessive memory allocation in ice_create_lag_recipe()
@ 2026-03-26 14:17 Aleksandr Loktionov
0 siblings, 0 replies; only message in thread
From: Aleksandr Loktionov @ 2026-03-26 14:17 UTC (permalink / raw)
To: intel-wired-lan, anthony.l.nguyen, aleksandr.loktionov
Cc: netdev, Marcin Szycik
From: Marcin Szycik <marcin.szycik@intel.com>
For some reason ice_create_lag_recipe() allocates an array of 64
struct ice_aqc_recipe_data_elem elements, while it only needs one (1).
Fix it, while also using kzalloc_obj().
Signed-off-by: Marcin Szycik <marcin.szycik@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
v2 -> v3 use sizeof(*new_rcp) in memcpy() to match the allocation (Jakub)
v1 -> v2 remove 'Fixes' from commit message because it's not a critical bug
---
drivers/net/ethernet/intel/ice/ice_lag.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index 310e8fe..9ad19c3 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -2418,11 +2418,11 @@ static int ice_create_lag_recipe(struct ice_hw *hw, u16 *rid,
if (err)
return err;
- new_rcp = kzalloc(ICE_RECIPE_LEN * ICE_MAX_NUM_RECIPES, GFP_KERNEL);
+ new_rcp = kzalloc_obj(*new_rcp, GFP_KERNEL);
if (!new_rcp)
return -ENOMEM;
- memcpy(new_rcp, base_recipe, ICE_RECIPE_LEN);
+ memcpy(new_rcp, base_recipe, sizeof(*new_rcp));
new_rcp->content.act_ctrl_fwd_priority = prio;
new_rcp->content.rid = *rid | ICE_AQ_RECIPE_ID_IS_ROOT;
new_rcp->recipe_indx = *rid;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-26 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 14:17 [PATCH iwl-next v3] ice: remove excessive memory allocation in ice_create_lag_recipe() Aleksandr Loktionov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox