diff options
author | Christian Engelmayer <cengelma@gmx.at> | 2014-03-21 03:25:30 -0700 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-03-21 03:25:30 -0700 |
commit | db41b87db93e1ef28b6e9c4035f1cdc17e2eceb2 (patch) | |
tree | e5e8044094c8594abc540af3ba859f4c80416b6e /drivers/net/ethernet/intel/igb/igb_ethtool.c | |
parent | 22a8b2915998a5f35f659c1d419bd4bcbb1b6f41 (diff) |
igb: Fix memory leak in igb_get_module_eeprom()
Fix a memory leak in the igb_get_module_eeprom() error handling path.
Detected by Coverity: CID 1016508.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index e35bc1faa452..d5c3e6572f2f 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -2791,9 +2791,11 @@ static int igb_get_module_eeprom(struct net_device *netdev, /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ for (i = 0; i < last_word - first_word + 1; i++) { status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); - if (status != E1000_SUCCESS) + if (status != E1000_SUCCESS) { /* Error occurred while reading module */ + kfree(dataword); return -EIO; + } be16_to_cpus(&dataword[i]); } |