[U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs
Benoît Thébaudeau
benoit.thebaudeau at advansee.com
Fri Aug 10 19:56:21 CEST 2012
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 <benoit.thebaudeau at advansee.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
---
{u-boot-4d3c95f.orig => u-boot-4d3c95f}/net/eth.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git u-boot-4d3c95f.orig/net/eth.c u-boot-4d3c95f/net/eth.c
index 1a11ce1..174361f 100644
--- u-boot-4d3c95f.orig/net/eth.c
+++ u-boot-4d3c95f/net/eth.c
@@ -222,9 +222,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;
}
More information about the U-Boot
mailing list