diff options
author | Simon Glass <sjg@chromium.org> | 2016-10-02 23:59:27 (GMT) |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-10-13 19:54:10 (GMT) |
commit | 9c07b9877cf07a1a971a79ed7c2369a58c0baca2 (patch) | |
tree | 916710a42689cef60b0e8725b415932c5c90eefe /lib/libfdt/fdt_rw.c | |
parent | 491c7b6f42a8101f1e84cf8e13a0e23b5eca729e (diff) | |
download | u-boot-fsl-qoriq-9c07b9877cf07a1a971a79ed7c2369a58c0baca2.tar.xz |
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>
Diffstat (limited to 'lib/libfdt/fdt_rw.c')
-rw-r--r-- | lib/libfdt/fdt_rw.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen) 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 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, 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), |