public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os().
Date: Thu, 21 Jan 2016 16:34:26 +0100	[thread overview]
Message-ID: <1453390466.4370.14.camel@gmail.com> (raw)
In-Reply-To: <1453279059-10967-1-git-send-email-purna.mandal@microchip.com>

Am Mittwoch, den 20.01.2016, 14:07 +0530 schrieb Purna Chandra Mandal:
> Variable _load_end_ points to end address of uncompressed buffer
> (*not* uncomress_buffer_end / sizeof(ulong)), so multipling
> uncompressed
> size with sizeof(ulong) is grossly incorrect in flush_cache().
> It might lead to access of address beyond valid memory range and hang
> the CPU.
> 
> Tested on MIPS architecture by using compressed(gzip, lzma)
> and uncompressed uImage.
> 
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

> ---
> 
>  common/bootm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/bootm.c b/common/bootm.c
> index 58936ca..99d574d 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -435,7 +435,7 @@ static int bootm_load_os(bootm_headers_t *images,
> unsigned long *load_end,
>  		bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
>  		return err;
>  	}
> -	flush_cache(load, (*load_end - load) * sizeof(ulong));
> +	flush_cache(load, *load_end - load);
>  
>  	debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load,
> *load_end);
>  	bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
-- 
- Daniel

  parent reply	other threads:[~2016-01-21 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20  8:37 [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os() Purna Chandra Mandal
2016-01-20 20:26 ` Simon Glass
2016-01-21 15:34 ` Daniel Schwierzeck [this message]
2016-01-25 21:28 ` [U-Boot] " 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=1453390466.4370.14.camel@gmail.com \
    --to=daniel.schwierzeck@gmail.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