summaryrefslogtreecommitdiffstats
path: root/common/fdt_support.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2013-05-27 18:01:19 +0000
committerTom Rini <trini@ti.com>2013-06-07 14:17:01 -0400
commit064d55f8bc8d7d205ed0be6abb6717e92eeb7cad (patch)
treea0ad2387c6404e0abd31ca7b64fcc75a24b98615 /common/fdt_support.c
parenta0ba279ac6b6b83b48dee609d7a34fc29b520ebc (diff)
downloadtalos-obmc-uboot-064d55f8bc8d7d205ed0be6abb6717e92eeb7cad.tar.gz
talos-obmc-uboot-064d55f8bc8d7d205ed0be6abb6717e92eeb7cad.zip
fdt: remove unaligned access in fdt_fixup_ethernet()
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as: char mac[16] = "ethaddr"; Replace this with a strcpy() call instead to avoid this. strcpy() is used here, rather than replacing all usage of the mac variable with the string itself, since the loop itself sprintf()s to the variable each iteration, so strcpy() is doing basically the same thing. Reported-by: Florian Meier Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Diffstat (limited to 'common/fdt_support.c')
-rw-r--r--common/fdt_support.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 416100e394..9a6f6b7d8b 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -458,7 +458,7 @@ void fdt_fixup_ethernet(void *fdt)
{
int node, i, j;
char enet[16], *tmp, *end;
- char mac[16] = "ethaddr";
+ char mac[16];
const char *path;
unsigned char mac_addr[6];
@@ -467,6 +467,7 @@ void fdt_fixup_ethernet(void *fdt)
return;
i = 0;
+ strcpy(mac, "ethaddr");
while ((tmp = getenv(mac)) != NULL) {
sprintf(enet, "ethernet%d", i);
path = fdt_getprop(fdt, node, enet, NULL);
OpenPOWER on IntegriCloud