From: Nishanth Menon <nm@ti.com>
To: Tom Rini <trini@konsulko.com>
Cc: <u-boot@lists.denx.de>, Aswath Govindraju <a-govindraju@ti.com>,
Tarun <t-sahu@ti.com>, Nishanth Menon <nm@ti.com>
Subject: [PATCH] spl: fit: Skip attempting to load 0 length image
Date: Tue, 19 Oct 2021 12:32:29 -0500 [thread overview]
Message-ID: <20211019173229.16200-1-nm@ti.com> (raw)
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>
---
common/spl/spl_fit.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index f41abca0ccb5..e9540dc2167a 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;
--
2.32.0
next reply other threads:[~2021-10-19 17:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 17:32 Nishanth Menon [this message]
2021-10-20 5:12 ` [PATCH] spl: fit: Skip attempting to load 0 length image Aswath Govindraju
2021-12-02 12:14 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211019173229.16200-1-nm@ti.com \
--to=nm@ti.com \
--cc=a-govindraju@ti.com \
--cc=t-sahu@ti.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox