]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootm: fix size arg of flush_cache() in bootm_load_os().
authorPurna Chandra Mandal <purna.mandal@microchip.com>
Wed, 20 Jan 2016 08:37:39 +0000 (14:07 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 25 Jan 2016 15:39:45 +0000 (10:39 -0500)
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: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
common/bootm.c

index 58936ca4978a9e3914abdfd415b84c133b73cfe9..99d574db2c52523f94946a01e65ca63a36521d37 100644 (file)
@@ -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);