From: Marcin Szycik <[email protected]>

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().

Fixes: 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on 
bonded interface")
Signed-off-by: Marcin Szycik <[email protected]>
Signed-off-by: Aleksandr Loktionov <[email protected]>
---
 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);
 

Reply via email to