diff options
author | Kok, Auke <auke-jan.h.kok@intel.com> | 2008-04-29 14:18:55 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-06 12:38:02 -0400 |
commit | f227ec3ca2b7be449fb2156e82b40cceed87a34a (patch) | |
tree | bf71b460b90b059bfc1192c001f676fd02a8afc2 /drivers | |
parent | e410553fd35afd6d290b65e02dc501722406377d (diff) |
e1000e: don't return half-read eeprom on error
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 2bb6da057c40..a14561f40db0 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -494,8 +494,12 @@ static int e1000_get_eeprom(struct net_device *netdev, | |||
494 | for (i = 0; i < last_word - first_word + 1; i++) { | 494 | for (i = 0; i < last_word - first_word + 1; i++) { |
495 | ret_val = e1000_read_nvm(hw, first_word + i, 1, | 495 | ret_val = e1000_read_nvm(hw, first_word + i, 1, |
496 | &eeprom_buff[i]); | 496 | &eeprom_buff[i]); |
497 | if (ret_val) | 497 | if (ret_val) { |
498 | /* a read error occurred, throw away the | ||
499 | * result */ | ||
500 | memset(eeprom_buff, 0xff, sizeof(eeprom_buff)); | ||
498 | break; | 501 | break; |
502 | } | ||
499 | } | 503 | } |
500 | } | 504 | } |
501 | 505 | ||