lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 7 Sep 2017 16:10:48 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Nisar.Sayed@...rochip.com
Cc:     davem@...emloft.net, UNGLinuxDriver@...rochip.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH net 2/3] lan78xx: Allow EEPROM write for less than
 MAX_EEPROM_SIZE

On Thu, Sep 07, 2017 at 07:11:26AM +0000, Nisar.Sayed@...rochip.com wrote:
> From: Nisar Sayed <Nisar.Sayed@...rochip.com>
> 
> Allow EEPROM write for less than MAX_EEPROM_SIZE
> 
> Signed-off-by: Nisar Sayed <Nisar.Sayed@...rochip.com>
> ---
>  drivers/net/usb/lan78xx.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index baf91c7..94ef943 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1299,6 +1299,10 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,

static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
                                      struct ethtool_eeprom *ee, u8 *data)
{
        struct lan78xx_net *dev = netdev_priv(netdev);


        /* Allow entire eeprom update only */
        if ((ee->magic == LAN78XX_EEPROM_MAGIC) &&
            (ee->offset == 0) &&
            (ee->len == 512) &&
            (data[0] == EEPROM_INDICATOR))
                return lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data);
       else if ((ee->magic == LAN78XX_OTP_MAGIC) &&
>  		 (ee->len == 512) &&
>  		 (data[0] == OTP_INDICATOR_1))
>  		ret = lan78xx_write_raw_otp(dev, ee->offset, ee->len, data);
> +	else if ((ee->magic == LAN78XX_EEPROM_MAGIC) &&
> +		 (ee->offset >= 0 && ee->offset < MAX_EEPROM_SIZE) &&
> +		 (ee->len > 0 && (ee->offset + ee->len) <= MAX_EEPROM_SIZE))
> +		ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data);
>  
>  	usb_autopm_put_interface(dev->intf);

Hi Nisar

You should explain why this change cannot be folded into the first if
statement.

	Andrew

Powered by blists - more mailing lists