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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181113210913.GD9828@lunn.ch>
Date:   Tue, 13 Nov 2018 22:09:13 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     thesven73@...il.com
Cc:     svendev@...x.com, siva.kallam@...adcom.com, prashant@...adcom.com,
        mchan@...adcom.com, davem@...emloft.net,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org, arnd@...db.de
Subject: Re: [PATCH v1] tg3: optionally get mac address from devicetree

> +static int tg3_of_get_macaddr(struct tg3 *tp)
>  {
> -	struct net_device *dev = tp->dev;
> -	struct pci_dev *pdev = tp->pdev;
> -	struct device_node *dp = pci_device_to_OF_node(pdev);
> -	const unsigned char *addr;
> -	int len;
> +	struct device_node *np = pci_device_to_OF_node(tp->pdev);
> +	const void *mac;
>  
> -	addr = of_get_property(dp, "local-mac-address", &len);
> -	if (addr && len == ETH_ALEN) {
> -		memcpy(dev->dev_addr, addr, ETH_ALEN);
> -		return 0;
> -	}
> -	return -ENODEV;
> +	if (!np)
> +		return -ENODEV;
> +	mac = of_get_mac_address(np);
> +	if (!mac || !is_valid_ether_addr(mac))
> +		return -EINVAL;

Hi Sven

If i'm reading of_get_mac_address() correctly, there is no need to
call is_valid_ether_addr() afterwards. It does it already.

     Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ