diff options
author | Tom Rini <trini@konsulko.com> | 2017-12-18 12:23:27 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-12-18 12:23:27 -0500 |
commit | 90d75d2efc376094b50d84de80e9cb8b3bcae032 (patch) | |
tree | a5bcce535313c824bca832b9b9ccbc7f870d35fa /tools | |
parent | a9e670d46f1916d6fb925244d5d4c9a48db8e26b (diff) | |
parent | 3e229a83bd4190f99731992d3a56983f29313899 (diff) |
Merge tag 'xilinx-for-v2018.01-rc2-v2' of git://www.denx.de/git/u-boot-microblaze
Xilinx changes for v2018.01-rc2-v2
fpga:
- Enable loading bitstream via fit image for !xilinx platforms
zynq:
- Fix SPL SD boot mode
zynqmp:
- Not not reset in panic
- Do not use simple allocator because of fat changes
- Various dt chagnes
- modeboot variable setup
- Fix fpga loading on automotive devices
- Fix coverity issues
test:
- Fix env test for !hush case - Stephen's patch
Diffstat (limited to 'tools')
-rw-r--r-- | tools/zynqmpimage.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 9667b11b2f8..f48ac6dbe50 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -245,16 +245,38 @@ static int zynqmpimage_check_image_types(uint8_t type) return EXIT_FAILURE; } -static int fsize(FILE *fp) +static uint32_t fsize(FILE *fp) { - int size; - int origin = ftell(fp); + int size, ret, origin; + + origin = ftell(fp); + if (origin < 0) { + fprintf(stderr, "Incorrect file size\n"); + fclose(fp); + exit(2); + } + + ret = fseek(fp, 0L, SEEK_END); + if (ret) { + fprintf(stderr, "Incorrect file SEEK_END\n"); + fclose(fp); + exit(3); + } - fseek(fp, 0L, SEEK_END); size = ftell(fp); + if (size < 0) { + fprintf(stderr, "Incorrect file size\n"); + fclose(fp); + exit(4); + } /* going back */ - fseek(fp, origin, SEEK_SET); + ret = fseek(fp, origin, SEEK_SET); + if (ret) { + fprintf(stderr, "Incorrect file SEEK_SET to %d\n", origin); + fclose(fp); + exit(3); + } return size; } |