[U-Boot-Users] [PATCH] mpc83xx: protect memcpy to bad address if a local-mac-address is missing from dt

Kim Phillips kim.phillips at freescale.com
Tue Jan 30 23:15:21 CET 2007


protect memcpy to bad address if a local-mac-address is missing from dt

---
 cpu/mpc83xx/cpu.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index bc61219..f1b2749 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -309,11 +309,13 @@ ft_cpu_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_MPC83XX_TSEC1
 	p = ft_get_prop(blob, "/" OF_SOC "/ethernet at 24000/local-mac-address", &len);
+	if (p != NULL)
 		memcpy(p, bd->bi_enetaddr, 6);
 #endif
 
 #ifdef CONFIG_MPC83XX_TSEC2
 	p = ft_get_prop(blob, "/" OF_SOC "/ethernet at 25000/local-mac-address", &len);
+	if (p != NULL)
 		memcpy(p, bd->bi_enet1addr, 6);
 #endif
 }
-- 
1.4.4





More information about the U-Boot mailing list