summaryrefslogtreecommitdiffstats
path: root/cpukit/include/libfdt_env.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-10-23 06:45:56 +0300
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-19 07:01:11 +0200
commit8073f95ef56a7c6dce04c04a12330b6c2839e23c (patch)
tree43d49cae0d12750281feb4c88dca9596b92df46c /cpukit/include/libfdt_env.h
parentlibfdt: Improve sequential write state checking (diff)
downloadrtems-8073f95ef56a7c6dce04c04a12330b6c2839e23c.tar.bz2
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 <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cpukit/include/libfdt_env.h')
-rw-r--r--cpukit/include/libfdt_env.h1
1 files changed, 1 insertions, 0 deletions
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 <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#ifdef __CHECKER__
#define FDT_FORCE __attribute__((force))