mirror of
https://github.com/torvalds/linux.git
synced 2024-12-24 03:42:52 +00:00
staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
Commit284eb16068
("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error") has introduced checking for ERR_PTR encoded error value from of_get_mac_address with IS_ERR macro, which is not sufficient in this case, as the mac variable is set to NULL initialy and if the kernel is compiled without DT support this NULL would get passed to IS_ERR, which would lead to the wrong decision and would pass that NULL pointer and invalid MAC address further. Fixes:284eb16068
("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error") Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4974f9b7e0
commit
da48be3373
@ -421,7 +421,7 @@ int cvm_oct_common_init(struct net_device *dev)
|
|||||||
if (priv->of_node)
|
if (priv->of_node)
|
||||||
mac = of_get_mac_address(priv->of_node);
|
mac = of_get_mac_address(priv->of_node);
|
||||||
|
|
||||||
if (!IS_ERR(mac))
|
if (!IS_ERR_OR_NULL(mac))
|
||||||
ether_addr_copy(dev->dev_addr, mac);
|
ether_addr_copy(dev->dev_addr, mac);
|
||||||
else
|
else
|
||||||
eth_hw_addr_random(dev);
|
eth_hw_addr_random(dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user