mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Teresa Remmet <t.remmet@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH] arm: boards: phytec-som-am335x: Fix mac overwrite from state
Date: Tue, 20 Nov 2018 14:47:10 +0100	[thread overview]
Message-ID: <1542721630-8082-1-git-send-email-t.remmet@phytec.de> (raw)

state_read_mac() returns 0 on success so mac never was overwritten.
Fix this and add check for valid mac address.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
 arch/arm/boards/phytec-som-am335x/board.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/phytec-som-am335x/board.c b/arch/arm/boards/phytec-som-am335x/board.c
index 8c24f2b33249..441d56348cc7 100644
--- a/arch/arm/boards/phytec-som-am335x/board.c
+++ b/arch/arm/boards/phytec-som-am335x/board.c
@@ -73,7 +73,7 @@ static const char *eth_names[ETH_COUNT] = {"mac0", "mac1"};
 static int physom_devices_init(void)
 {
 	struct state *state;
-	u8 mac[6];
+	uint8_t mac[6];
 	int state_ret;
 	int state_i;
 
@@ -130,7 +130,7 @@ static int physom_devices_init(void)
 			for (state_i = 0; state_i < 2; state_i++) {
 				state_ret = state_read_mac(state,
 						      eth_names[state_i], &mac[0]);
-				if (state_ret == 6)
+				if (!state_ret && is_valid_ether_addr(&mac[0]))
 					eth_register_ethaddr(state_i, mac);
 			}
 	}
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2018-11-20 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 13:47 Teresa Remmet [this message]
2018-11-21  8:03 ` Sascha Hauer

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=1542721630-8082-1-git-send-email-t.remmet@phytec.de \
    --to=t.remmet@phytec.de \
    --cc=barebox@lists.infradead.org \
    /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