* [PATCH v2 net 2/3] lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE
@ 2017-09-11 18:52 Nisar.Sayed
2017-09-11 20:13 ` Woojung.Huh
0 siblings, 1 reply; 2+ messages in thread
From: Nisar.Sayed @ 2017-09-11 18:52 UTC (permalink / raw)
To: davem; +Cc: UNGLinuxDriver, netdev
From: Nisar Sayed <Nisar.Sayed@microchip.com>
Allow EEPROM write for less than MAX_EEPROM_SIZE
Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Nisar Sayed <Nisar.Sayed@microchip.com>
---
drivers/net/usb/lan78xx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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) &&
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH v2 net 2/3] lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE
2017-09-11 18:52 [PATCH v2 net 2/3] lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE Nisar.Sayed
@ 2017-09-11 20:13 ` Woojung.Huh
0 siblings, 0 replies; 2+ messages in thread
From: Woojung.Huh @ 2017-09-11 20:13 UTC (permalink / raw)
To: Nisar.Sayed, davem; +Cc: UNGLinuxDriver, netdev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-11 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 18:52 [PATCH v2 net 2/3] lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE Nisar.Sayed
2017-09-11 20:13 ` Woojung.Huh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.