Skip to content

Commit 90ca695

Browse files
Dan Carpenteranguy11
authored andcommitted
ice: Fix freeing uninitialized pointers
Automatically cleaned up pointers need to be initialized before exiting their scope. In this case, they need to be initialized to NULL before any return statement. Fixes: 90f821d ("ice: avoid unnecessary devm_ usage") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 0a6380c commit 90ca695

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)
10021002
*/
10031003
int ice_init_hw(struct ice_hw *hw)
10041004
{
1005-
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
1006-
void *mac_buf __free(kfree);
1005+
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
1006+
void *mac_buf __free(kfree) = NULL;
10071007
u16 mac_buf_len;
10081008
int status;
10091009

@@ -3272,7 +3272,7 @@ int ice_update_link_info(struct ice_port_info *pi)
32723272
return status;
32733273

32743274
if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) {
3275-
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
3275+
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
32763276

32773277
pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
32783278
if (!pcaps)
@@ -3420,7 +3420,7 @@ ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
34203420
int
34213421
ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)
34223422
{
3423-
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
3423+
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
34243424
struct ice_aqc_set_phy_cfg_data cfg = { 0 };
34253425
struct ice_hw *hw;
34263426
int status;
@@ -3561,7 +3561,7 @@ int
35613561
ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
35623562
enum ice_fec_mode fec)
35633563
{
3564-
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
3564+
struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
35653565
struct ice_hw *hw;
35663566
int status;
35673567

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,11 @@ static u64 ice_loopback_test(struct net_device *netdev)
941941
struct ice_netdev_priv *np = netdev_priv(netdev);
942942
struct ice_vsi *orig_vsi = np->vsi, *test_vsi;
943943
struct ice_pf *pf = orig_vsi->back;
944+
u8 *tx_frame __free(kfree) = NULL;
944945
u8 broadcast[ETH_ALEN], ret = 0;
945946
int num_frames, valid_frames;
946947
struct ice_tx_ring *tx_ring;
947948
struct ice_rx_ring *rx_ring;
948-
u8 *tx_frame __free(kfree);
949949
int i;
950950

951951
netdev_info(netdev, "loopback test\n");

0 commit comments

Comments
 (0)