Skip to content

Commit 81b7008

Browse files
ynezzclaudiubeznea
authored andcommitted
staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
Commit 284eb16 ("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: 284eb16 ("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>
1 parent 0f11a77 commit 81b7008

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/staging/octeon/ethernet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ int cvm_oct_common_init(struct net_device *dev)
422422
if (priv->of_node)
423423
mac = of_get_mac_address(priv->of_node);
424424

425-
if (mac)
425+
if (!IS_ERR_OR_NULL(mac))
426426
ether_addr_copy(dev->dev_addr, mac);
427427
else
428428
eth_hw_addr_random(dev);

0 commit comments

Comments
 (0)