diff options
author | Simon Glass <sjg@chromium.org> | 2021-02-15 17:08:09 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-02-15 22:31:52 -0500 |
commit | c5819701a3de61e2ba2ef7ad0b616565b32305e5 (patch) | |
tree | 2d78afc29b784d5477102dabfc94215781126ae0 /common/update.c | |
parent | d5f3aadacbc63df3b690d6fd9f0aa3f575b43356 (diff) | |
download | u-boot-c5819701a3de61e2ba2ef7ad0b616565b32305e5.tar.gz |
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/update.c')
-rw-r--r-- | common/update.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/update.c b/common/update.c index a5879cb52c..f0848954e5 100644 --- a/common/update.c +++ b/common/update.c @@ -286,7 +286,7 @@ int update_tftp(ulong addr, char *interface, char *devstring) got_update_file: fit = map_sysmem(addr, 0); - if (!fit_check_format((void *)fit)) { + if (fit_check_format((void *)fit, IMAGE_SIZE_INVAL)) { printf("Bad FIT format of the update file, aborting " "auto-update\n"); return 1; @@ -363,7 +363,7 @@ int fit_update(const void *fit) if (!fit) return -EINVAL; - if (!fit_check_format((void *)fit)) { + if (fit_check_format((void *)fit, IMAGE_SIZE_INVAL)) { printf("Bad FIT format of the update file, aborting auto-update\n"); return -EINVAL; } |