summaryrefslogtreecommitdiff
path: root/common/splash_source.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-15 17:08:09 -0700
committerTom Rini <trini@konsulko.com>2021-02-15 22:31:52 -0500
commitc5819701a3de61e2ba2ef7ad0b616565b32305e5 (patch)
tree2d78afc29b784d5477102dabfc94215781126ae0 /common/splash_source.c
parentd5f3aadacbc63df3b690d6fd9f0aa3f575b43356 (diff)
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/splash_source.c')
-rw-r--r--common/splash_source.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/splash_source.c b/common/splash_source.c
index 2737fc6e7f..d7f179e3ea 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -337,10 +337,10 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
if (res < 0)
return res;
- res = fit_check_format(fit_header);
- if (!res) {
+ res = fit_check_format(fit_header, IMAGE_SIZE_INVAL);
+ if (res) {
debug("Could not find valid FIT image\n");
- return -EINVAL;
+ return res;
}
/* Get the splash image node */