public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs
Date: Fri, 10 Aug 2012 19:56:21 +0200 (CEST)	[thread overview]
Message-ID: <821911102.2280760.1344621381185.JavaMail.root@advansee.com> (raw)

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;
 }

             reply	other threads:[~2012-08-10 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 17:56 Benoît Thébaudeau [this message]
2012-08-11 17:48 ` [U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs Mike Frysinger
2012-09-28 16:04 ` Joe Hershberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=821911102.2280760.1344621381185.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox