* [PATCH iwl-next v2] ice: remove excessive memory allocation in ice_create_lag_recipe()
@ 2026-03-23 9:50 Aleksandr Loktionov
2026-03-23 22:49 ` Joe Damato
0 siblings, 1 reply; 2+ messages in thread
From: Aleksandr Loktionov @ 2026-03-23 9:50 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>
---
v1 -> v2 remove 'Fixes' from commit message because it's not a critical bug
---
drivers/net/ethernet/intel/ice/ice_lag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index 310e8fe..70357dc 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -2418,8 +2418,8 @@ 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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iwl-next v2] ice: remove excessive memory allocation in ice_create_lag_recipe()
2026-03-23 9:50 [PATCH iwl-next v2] ice: remove excessive memory allocation in ice_create_lag_recipe() Aleksandr Loktionov
@ 2026-03-23 22:49 ` Joe Damato
0 siblings, 0 replies; 2+ messages in thread
From: Joe Damato @ 2026-03-23 22:49 UTC (permalink / raw)
To: Aleksandr Loktionov
Cc: intel-wired-lan, anthony.l.nguyen, netdev, Marcin Szycik
On Mon, Mar 23, 2026 at 10:50:56AM +0100, Aleksandr Loktionov wrote:
> 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>
> ---
> v1 -> v2 remove 'Fixes' from commit message because it's not a critical bug
> ---
> drivers/net/ethernet/intel/ice/ice_lag.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
> index 310e8fe..70357dc 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lag.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lag.c
> @@ -2418,8 +2418,8 @@ 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);
idk but should this memcpy be updated to sizeof(*new_rcp) to match the updated
allocation ? feels slightly easier to read (vs knowing that sizeof(*new_rcp)
== ICE_RECIPE_LEN).
either way:
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-23 22:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 9:50 [PATCH iwl-next v2] ice: remove excessive memory allocation in ice_create_lag_recipe() Aleksandr Loktionov
2026-03-23 22:49 ` Joe Damato
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox