Skip to contentSkip to conversation

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

PATCH New Kim Phillips 3 participants 3 messages Jan 30, 2007 – Jan 31, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc83xx: protect memcpy to bad address if a local-mac-address is missing from dt

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(-)
cpu/mpc83xx/cpu.c +2 -0
index bc61219..f1b2749 100644
@@ -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
 }
Signature · 1 line
1.4.4
#1 lore raw

PATCH 1/1 mpc83xx: protect memcpy to bad address if a local-mac-address is missing from dt

Quoted 2 lines · Kim Phillips

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

How about fixing 85xx as well since its broken in the same way.

- k

Quoted 40 lines
---
 cpu/mpc83xx/cpu.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
cpu/mpc83xx/cpu.c +2 -0
index bc61219..f1b2749 100644
@@ -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
}

Signature · 15 lines
1.4.4


---------------------------------------------------------------------- 
---
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to  
share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php? 
page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
#2 lore raw

PATCH 1/1 mpc83xx: protect memcpy to bad address if a local-mac-address is missing from dt

Quoted 1 line · Kumar Gala

How about fixing 85xx as well since its broken in the same way.

Why do we have separate 83xx and 85xx versions of the same thing? We should be combining all of this now, and standardizing on the calling conventions. Either all of the board ports call the generic function, or having the generic function called by default with the possibility for a board specific callout to follow for any fix up. While you are at it, the 86xx and some 8xx should be combined as well.

Thanks.

	-- Dan