All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aswath Govindraju <a-govindraju@ti.com>
To: Nishanth Menon <nm@ti.com>, Tom Rini <trini@konsulko.com>
Cc: <u-boot@lists.denx.de>, Tarun <t-sahu@ti.com>
Subject: Re: [PATCH] spl: fit: Skip attempting to load 0 length image
Date: Wed, 20 Oct 2021 10:42:11 +0530	[thread overview]
Message-ID: <13a53644-cab5-63b6-fd3d-26c65056718b@ti.com> (raw)
In-Reply-To: <20211019173229.16200-1-nm@ti.com>

On 19/10/21 11:02 pm, Nishanth Menon wrote:
> 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>

Thanks,
Aswath

>  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;
>  
> 


  reply	other threads:[~2021-10-20  5:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 17:32 [PATCH] spl: fit: Skip attempting to load 0 length image Nishanth Menon
2021-10-20  5:12 ` Aswath Govindraju [this message]
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=13a53644-cab5-63b6-fd3d-26c65056718b@ti.com \
    --to=a-govindraju@ti.com \
    --cc=nm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.