mirror of
https://xff.cz/git/u-boot/
synced 2025-09-03 17:52:07 +02:00
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>
This commit is contained in:
@@ -917,7 +917,7 @@ static int nand_load_image(struct cmd_tbl *cmdtp, struct mtd_info *mtd,
|
||||
#if defined(CONFIG_FIT)
|
||||
/* This cannot be done earlier, we need complete FIT image in RAM first */
|
||||
if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
|
||||
if (!fit_check_format (fit_hdr)) {
|
||||
if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) {
|
||||
bootstage_error(BOOTSTAGE_ID_NAND_FIT_READ);
|
||||
puts ("** Bad FIT image format\n");
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user