Message ID | 20240904123306.14629-2-przemyslaw.kitszel@intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [iwl-net] ice: fix memleak in ice_init_tx_topology() | expand |
On 9/4/2024 5:32 AM, Przemek Kitszel wrote: > dev = ice_pf_to_dev(pf); > - /* ice_cfg_tx_topo buf argument is not a constant, > - * so we have to make a copy > - */ > - buf_copy = kmemdup(firmware->data, firmware->size, GFP_KERNEL); > - > - err = ice_cfg_tx_topo(hw, buf_copy, firmware->size); > + err = ice_cfg_tx_topo(hw, (void *)firmware->data, firmware->size); > if (!err) { Yea, just casting away the const is sufficient here, the function doesn't modify this buffer. Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 6f97ed471fe9..71f592dda156 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4535,16 +4535,10 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware) u8 num_tx_sched_layers = hw->num_tx_sched_layers; struct ice_pf *pf = hw->back; struct device *dev; - u8 *buf_copy; int err; dev = ice_pf_to_dev(pf); - /* ice_cfg_tx_topo buf argument is not a constant, - * so we have to make a copy - */ - buf_copy = kmemdup(firmware->data, firmware->size, GFP_KERNEL); - - err = ice_cfg_tx_topo(hw, buf_copy, firmware->size); + err = ice_cfg_tx_topo(hw, (void *)firmware->data, firmware->size); if (!err) { if (hw->num_tx_sched_layers > num_tx_sched_layers) dev_info(dev, "Tx scheduling layers switching feature disabled\n");