build/patch/u-boot/u-boot-sunxi/allwinner-fdt-setprop-fix-unaligned-access.patch

25 lines
664 B
Diff

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 8e51a43126..0e94bf30ee 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -18,6 +18,7 @@
#include <fdt_support.h>
#include <mapmem.h>
#include <asm/io.h>
+#include <asm/unaligned.h>
#define MAX_LEVEL 32 /* how deeply nested we will go */
#define SCRATCHPAD 1024 /* bytes of scratchpad memory */
@@ -802,7 +803,10 @@ static int fdt_parse_prop(char * const *newval, int count, char *data, int *len)
cp = newp;
tmp = simple_strtoul(cp, &newp, 0);
if (*cp != '?')
- *(fdt32_t *)data = cpu_to_fdt32(tmp);
+ {
+ tmp = cpu_to_fdt32(tmp);
+ put_unaligned(tmp, (fdt32_t *)data);
+ }
else
newp++;