libfdt: Check that there is only one root node

At present it is possible to have two root nodes and even access nodes
in the 'second' root. Such trees should not be considered valid. This
was discovered as part of a security investigation into U-Boot verified

Add a check for this to fdt_check_full().

Signed-off-by: Simon Glass <>
Reported-by: Arie Haenel <>
Reported-by: Julien Lenoir <>
Message-Id: <>
Signed-off-by: David Gibson <>
6 files changed