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 /drivers/fpga/socfpga_arria10.c | |
parent | d5f3aadacbc63df3b690d6fd9f0aa3f575b43356 (diff) | |
download | u-boot-c5819701a3de61e2ba2ef7ad0b616565b32305e5.zip u-boot-c5819701a3de61e2ba2ef7ad0b616565b32305e5.tar.gz u-boot-c5819701a3de61e2ba2ef7ad0b616565b32305e5.tar.bz2 |
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 'drivers/fpga/socfpga_arria10.c')
-rw-r--r-- | drivers/fpga/socfpga_arria10.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c index 4bea7fd..b992e6f 100644 --- a/drivers/fpga/socfpga_arria10.c +++ b/drivers/fpga/socfpga_arria10.c @@ -566,10 +566,10 @@ static int first_loading_rbf_to_buffer(struct udevice *dev, if (ret < 0) return ret; - ret = fit_check_format(buffer_p); - if (!ret) { + ret = fit_check_format(buffer_p, IMAGE_SIZE_INVAL); + if (ret) { debug("FPGA: No valid FIT image was found.\n"); - return -EBADF; + return ret; } confs_noffset = fdt_path_offset(buffer_p, FIT_CONFS_PATH); |