From 8073f95ef56a7c6dce04c04a12330b6c2839e23c Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 23 Oct 2017 06:45:56 +0300 Subject: libfdt: Make fdt_check_header() more thorough Currently fdt_check_header() performs only some rudimentary checks, which is not really what the name suggests. This strengthens fdt_check_header() to check as much about the blob as is possible from the header alone: as well as checking the magic number and version, it checks that the total size is sane, and that all the sub-blocks within the blob lie within the total size. * This broadens the meaning of FDT_ERR_TRUNCATED to cover all sorts of improperly terminated blocks as well as just a structure block without FDT_END. * This makes fdt_check_header() only succeed on "complete" blobs, not in-progress sequential write blobs. The only reason this didn't fail before was that this function used to be called by many RO functions which are supposed to also work on incomplete SW blobs. Signed-off-by: David Gibson Tested-by: Alexey Kardashevskiy Reviewed-by: Alexey Kardashevskiy Reviewed-by: Simon Glass --- cpukit/include/libfdt_env.h | 1 + 1 file changed, 1 insertion(+) (limited to 'cpukit/include/libfdt_env.h') diff --git a/cpukit/include/libfdt_env.h b/cpukit/include/libfdt_env.h index bd24746287..eb2053845c 100644 --- a/cpukit/include/libfdt_env.h +++ b/cpukit/include/libfdt_env.h @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef __CHECKER__ #define FDT_FORCE __attribute__((force)) -- cgit v1.2.3