libfdt: Sync up with upstream
This includes small changes to the following functions, from upstream
commit 6d1832c:
- fdt_get_max_phandle() (upstream commit 84e0e134)
- fdt_node_check_compatible (upstream commit 53bf130b)
- fdt_setprop_inplace_namelen_partial() to remove useless brackets and
use idx instead of index
- _fdt_resize_property() to use idx instead of index
- _fdt_splice() (upstream commit d4c7c25c)
It also includes various typo fixes in libfdt.h
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c
index 47447b2..87d4030 100644
--- a/lib/libfdt/fdt_rw.c
+++ b/lib/libfdt/fdt_rw.c
@@ -60,6 +60,8 @@
if (((p + oldlen) < p) || ((p + oldlen) > end))
return -FDT_ERR_BADOFFSET;
+ if ((p < (char *)fdt) || ((end - oldlen + newlen) < (char *)fdt))
+ return -FDT_ERR_BADOFFSET;
if ((end - oldlen + newlen) > ((char *)fdt + fdt_totalsize(fdt)))
return -FDT_ERR_NOSPACE;
memmove(p + newlen, p + oldlen, end - p - oldlen);
@@ -164,7 +166,7 @@
int err;
*prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
- if (!(*prop))
+ if (!*prop)
return oldlen;
if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),