Skip to content

Commit

Permalink
e1000e: don't return half-read eeprom on error
Browse files Browse the repository at this point in the history
On a read error, e1000e might have returned uninitialized block of
eeprom data back to userspace. The convention is that 0xff is "empty",
so mark the entire eeprom as empty in case of an error.

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Kok, Auke authored and Jeff Garzik committed May 6, 2008
1 parent e410553 commit f227ec3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/e1000e/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,12 @@ static int e1000_get_eeprom(struct net_device *netdev,
for (i = 0; i < last_word - first_word + 1; i++) {
ret_val = e1000_read_nvm(hw, first_word + i, 1,
&eeprom_buff[i]);
if (ret_val)
if (ret_val) {
/* a read error occurred, throw away the
* result */
memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
break;
}
}
}

Expand Down

0 comments on commit f227ec3

Please sign in to comment.