summaryrefslogtreecommitdiff
path: root/common/image-fdt.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-16 03:08:09 +0300
committerTom Rini <trini@konsulko.com>2021-02-16 06:31:52 +0300
commitc5819701a3de61e2ba2ef7ad0b616565b32305e5 (patch)
tree2d78afc29b784d5477102dabfc94215781126ae0 /common/image-fdt.c
parentd5f3aadacbc63df3b690d6fd9f0aa3f575b43356 (diff)
downloadu-boot-c5819701a3de61e2ba2ef7ad0b616565b32305e5.tar.xz
image: Adjust the workings of fit_check_format()
At present this function does not accept a size for the FIT. This means that it must be read from the FIT itself, introducing potential security risk. Update the function to include a size parameter, which can be invalid, in which case fit_check_format() calculates it. For now no callers pass the size, but this can be updated later. Also adjust the return value to an error code so that all the different types of problems can be distinguished by the user. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Bruce Monroe <bruce.monroe@intel.com> Reported-by: Arie Haenel <arie.haenel@intel.com> Reported-by: Julien Lenoir <julien.lenoir@intel.com>
Diffstat (limited to 'common/image-fdt.c')
-rw-r--r--common/image-fdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 0157cce32d..61ce6e5779 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -400,7 +400,7 @@ int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
*/
#if CONFIG_IS_ENABLED(FIT)
/* check FDT blob vs FIT blob */
- if (fit_check_format(buf)) {
+ if (!fit_check_format(buf, IMAGE_SIZE_INVAL)) {
ulong load, len;
fdt_noffset = boot_get_fdt_fit(images,