From: Benoît Thébaudeau Date: Fri, 10 Aug 2012 07:56:21 +0000 (+0000) Subject: net: eth_write_hwaddr: Return error for invalid MACs X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=460f949f897a401b40327be7a1a9cccd22762c77;p=u-boot.git net: eth_write_hwaddr: Return error for invalid MACs If dev->enetaddr was supposed to be set with dev->write_hwaddr() but the MAC address was not valid, return an error. Signed-off-by: Benoît Thébaudeau Cc: Joe Hershberger Acked-by: Mike Frysinger --- diff --git a/net/eth.c b/net/eth.c index 49458c8db9..321d5b18fd 100644 --- a/net/eth.c +++ b/net/eth.c @@ -218,9 +218,12 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name, } if (dev->write_hwaddr && - !eth_mac_skip(eth_number) && - is_valid_ether_addr(dev->enetaddr)) + !eth_mac_skip(eth_number)) { + if (!is_valid_ether_addr(dev->enetaddr)) + return -1; + ret = dev->write_hwaddr(dev); + } return ret; }