Fix sunxi u-boot crash in fdt setprop
This commit is contained in:
parent
dbdf2a0f15
commit
a717f1a506
@ -0,0 +1,24 @@
|
||||
diff --git a/cmd/fdt.c b/cmd/fdt.c
|
||||
index d7654b2c4f..a71b7713a8 100644
|
||||
--- a/cmd/fdt.c
|
||||
+++ b/cmd/fdt.c
|
||||
@@ -17,6 +17,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 */
|
||||
@@ -781,7 +782,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++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user