platform_external_dtc/libfdt
David Gibson 1087504bb3 libfdt: Add necessary header padding in fdt_create()
At present fdt_create() will succeed if there is exactly enough space to
put in the fdt header.  However, it sets the off_mem_rsvmap field, a few
bytes past that in order to align the memory reservation block.

Having block pointers pointing past the end of the fdt is pretty ugly, even
if it is just a transient state.  Worse, if fdt_resize() is called at
exactly the wrong time, it can end up accessing data past the blob's
allocated space because of this.

So, correct fdt_create() to ensure that there is sufficient space for the
alignment padding as well as the plain header.  For paranoia, also add a
check in fdt_resize() to make sure we don't copy data from outside the
blob's bounds.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-07-09 15:03:14 +10:00
..
fdt.c libfdt: Add fdt_header_size() 2018-06-07 11:49:14 +10:00
fdt.h libfdt: Remove leading underscores from identifiers 2017-10-26 09:25:14 +02:00
fdt_addresses.c libfdt: Add helpers to read #address-cells and #size-cells 2014-05-12 16:01:09 +10:00
fdt_empty_tree.c Fix a few whitespace and style nits 2017-04-09 20:56:37 +10:00
fdt_overlay.c libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
fdt_ro.c libfdt: Add helpers for accessing unaligned words 2018-06-26 15:09:46 +10:00
fdt_rw.c libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
fdt_strerror.c libfdt: add missing errors to fdt_strerror() 2016-11-04 07:17:20 +11:00
fdt_sw.c libfdt: Add necessary header padding in fdt_create() 2018-07-09 15:03:14 +10:00
fdt_wip.c libfdt: Remove leading underscores from identifiers 2017-10-26 09:25:14 +02:00
libfdt.h libfdt: Add helpers for accessing unaligned words 2018-06-26 15:09:46 +10:00
libfdt_env.h libfdt: Make fdt_check_header() more thorough 2018-06-07 11:47:59 +10:00
libfdt_internal.h libfdt: Clean up header checking functions 2018-06-07 11:45:44 +10:00
Makefile.libfdt libfdt: Add overlay application function 2016-10-06 19:22:41 +11:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
version.lds libfdt: Safer access to strings section 2018-06-07 11:48:20 +10:00