提交 db41b87d 编写于 作者: C Christian Engelmayer 提交者: Jeff Kirsher

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: NChristian Engelmayer <cengelma@gmx.at>
Tested-by: NJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 22a8b291
......@@ -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]);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册