public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs
@ 2012-08-10 17:56 Benoît Thébaudeau
  2012-08-11 17:48 ` Mike Frysinger
  2012-09-28 16:04 ` Joe Hershberger
  0 siblings, 2 replies; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-08-10 17:56 UTC (permalink / raw)
  To: u-boot

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@advansee.com>
Cc: Joe Hershberger <joe.hershberger@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;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-28 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-10 17:56 [U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs Benoît Thébaudeau
2012-08-11 17:48 ` Mike Frysinger
2012-09-28 16:04 ` Joe Hershberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox