Skip to content
Snippets Groups Projects
Commit 6dfd65f8 authored by Bernhard Messerklinger's avatar Bernhard Messerklinger Committed by Simon Glass
Browse files

cmd/fdt.c align data buffer to avoid unaligned word access


Since the compiler is free to place a char array to any address in
memory (in this case the stack), also to a non word aligned address the
function "fdt_prop_parse" runs into troubles upon it wants to write some
(fdt32_t *) to such a variable (if it has been placed to a none word
aligned address).

To avoid this we tell the compiler to always align this scratchpad to a
word aligned address.

Signed-off-by: default avatarBernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: default avatarHannes Schmelzer <oe5hpm@oevsv.at>
Tested-by: default avatarHannes Schmelzer <oe5hpm@oevsv.at>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent c253573f
No related branches found
No related tags found
No related merge requests found
......@@ -256,7 +256,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *pathp; /* path */
char *prop; /* property */
int nodeoffset; /* node offset from libfdt */
static char data[SCRATCHPAD]; /* storage for the property */
static char data[SCRATCHPAD] __aligned(4);/* property storage */
const void *ptmp;
int len; /* new length of the property */
int ret; /* return value */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment