platform_external_dtc/libfdt
David Gibson b8d6eca782 libfdt: Allow #size-cells of 0
c12b2b0c20 "libfdt: fdt_address_cells() and fdt_size_cells()" introduced
a bug as it consolidated code between the helpers for getting
#address-cells and #size-cells.  Specifically #size-cells is allowed to
be 0, and is frequently found so in practice for /cpus.  IEEE1275 only
requires implementations to handle 1..4 for #address-cells, although one
could make a case for #address-cells == #size-cells == 0 being used to
represent a bridge with a single port.

While we're there, it's not totally obvious that the existing implicit
cast of a u32 to int will give the correct results according to strict C,
although it does work in practice.  Straighten that up to cast only after
we've made our range checks.

Reported-by: yonghuhaige via https://github.com/dgibson/dtc/issues/28
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-07-28 16:31:44 +10:00
..
.gitignore Link tools and tests against libfdt shared library 2019-03-29 17:20:16 +11:00
fdt.c libfdt: Tweak data handling to satisfy Coverity 2019-07-05 15:31:12 +10:00
fdt.h libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_addresses.c libfdt: Allow #size-cells of 0 2019-07-28 16:31:44 +10:00
fdt_empty_tree.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_overlay.c fdtoverlay: Ignore symbols in overlays which don't apply to the target tree 2019-07-04 15:10:01 +10:00
fdt_ro.c libfdt: Tweak data handling to satisfy Coverity 2019-07-05 15:31:12 +10:00
fdt_rw.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_strerror.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_sw.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_wip.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
libfdt.h libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
libfdt_env.h libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
libfdt_internal.h libfdt: Tweak data handling to satisfy Coverity 2019-07-05 15:31:12 +10:00
Makefile.libfdt libfdt: Add dual GPL/BSD SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
version.lds libfdt: Add dual GPL/BSD SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00