arm: boards: phytec-som-am335x: Fix mac overwrite from state
PATCH 1/1 arm: boards: phytec-som-am335x: Fix mac overwrite from state
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 <[email protected]>
--- arch/arm/boards/phytec-som-am335x/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boards/phytec-som-am335x/board.c +2 -2
@@ -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); } }
Signature · 7 lines
2.7.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 7 lines · Teresa Remmet
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 <[email protected]>--- arch/arm/boards/phytec-som-am335x/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
Quoted 32 lines
arch/arm/boards/phytec-som-am335x/board.c +2
-2@@ -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); } }Signature · 7 lines
2.7.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox