diff options
author | Tom Rini <trini@konsulko.com> | 2016-10-13 20:03:33 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-13 20:03:33 -0400 |
commit | 4504062b271bf4d1cf256e4e87e156de6029e088 (patch) | |
tree | a0cac720a2687f2ed4ccf15f473d06bb7c8dcb07 /lib/libfdt/fdt_rw.c | |
parent | 44afdc4a12b9f6f48338e7975e4f08cfe90dba74 (diff) | |
parent | 42b7600d62ae288a8c12431d232b89b26ec61721 (diff) | |
download | u-boot-imx-4504062b271bf4d1cf256e4e87e156de6029e088.zip u-boot-imx-4504062b271bf4d1cf256e4e87e156de6029e088.tar.gz u-boot-imx-4504062b271bf4d1cf256e4e87e156de6029e088.tar.bz2 |
Merge git://git.denx.de/u-boot-fdt
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), |