mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
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>
This commit is contained in:
parent
a0ba279ac6
commit
064d55f8bc
1 changed files with 2 additions and 1 deletions
|
@ -458,7 +458,7 @@ void fdt_fixup_ethernet(void *fdt)
|
||||||
{
|
{
|
||||||
int node, i, j;
|
int node, i, j;
|
||||||
char enet[16], *tmp, *end;
|
char enet[16], *tmp, *end;
|
||||||
char mac[16] = "ethaddr";
|
char mac[16];
|
||||||
const char *path;
|
const char *path;
|
||||||
unsigned char mac_addr[6];
|
unsigned char mac_addr[6];
|
||||||
|
|
||||||
|
@ -467,6 +467,7 @@ void fdt_fixup_ethernet(void *fdt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
strcpy(mac, "ethaddr");
|
||||||
while ((tmp = getenv(mac)) != NULL) {
|
while ((tmp = getenv(mac)) != NULL) {
|
||||||
sprintf(enet, "ethernet%d", i);
|
sprintf(enet, "ethernet%d", i);
|
||||||
path = fdt_getprop(fdt, node, enet, NULL);
|
path = fdt_getprop(fdt, node, enet, NULL);
|
||||||
|
|
Loading…
Reference in a new issue