diff options
author | Nishanth Menon <nm@ti.com> | 2021-10-19 12:32:29 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-12-01 13:33:45 -0500 |
commit | b515e8c8f561a82f1e0cb02465ae8af096636587 (patch) | |
tree | 9f719fcf5db678de1fdbce260bac5ac1644ba028 | |
parent | 5884f223743ddcd44ea6a0215c8b9789fdc39e44 (diff) | |
download | u-boot-WIP/2021-12-01-assorted-updates.zip u-boot-WIP/2021-12-01-assorted-updates.tar.gz u-boot-WIP/2021-12-01-assorted-updates.tar.bz2 |
spl: fit: Skip attempting to load 0 length imageWIP/2021-12-01-assorted-updates
When, for various reasons, a bad FIT image is used where a loadable
image is marked as 0 length, attempt is made for a 0 length allocation and
read of 0 byte read operation.
Instead provide warning in log and skip attempting to do such a load.
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
-rw-r--r-- | common/spl/spl_fit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 5fe0273..774072b 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -286,6 +286,13 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, if (fit_image_get_data_size(fit, node, &len)) return -ENOENT; + /* Dont bother to copy 0 byte data, but warn, though */ + if (!len) { + log_warning("%s: Skip load '%s': image size is 0!\n", + __func__, fit_get_name(fit, node, NULL)); + return 0; + } + src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); length = len; |