Message ID | CE371C1263339941885964188A0225FA335C94@CHN-SV-EXMX03.mchp-main.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Series | lan78xx: Fixes to lan78xx driver | expand |
Nisar, >@@ -1290,8 +1290,8 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev, > > /* Allow entire eeprom update only */ > if ((ee->magic == LAN78XX_EEPROM_MAGIC) && >- (ee->offset == 0) && >- (ee->len == 512) && >+ (ee->offset >= 0 && ee->offset < MAX_EEPROM_SIZE) && >+ (ee->len > 0 && (ee->offset + ee->len) <= MAX_EEPROM_SIZE) && > (data[0] == EEPROM_INDICATOR)) This patch is for writing any len at any offset. However, "(data[0] == EEPROM_INDICATOR)" prevents it. > ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data); > else if ((ee->magic == LAN78XX_OTP_MAGIC) && - Woojung
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index baf91c7..02d64f75 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1290,8 +1290,8 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev, /* Allow entire eeprom update only */ if ((ee->magic == LAN78XX_EEPROM_MAGIC) && - (ee->offset == 0) && - (ee->len == 512) && + (ee->offset >= 0 && ee->offset < MAX_EEPROM_SIZE) && + (ee->len > 0 && (ee->offset + ee->len) <= MAX_EEPROM_SIZE) && (data[0] == EEPROM_INDICATOR)) ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data); else if ((ee->magic == LAN78XX_OTP_MAGIC) &&