From: Purna Chandra Mandal Date: Wed, 20 Jan 2016 08:37:39 +0000 (+0530) Subject: bootm: fix size arg of flush_cache() in bootm_load_os(). X-Git-Tag: v2016.03-rc1~74 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8d4f11c2033d0621f22a1501d92616596a8d1a62;p=u-boot bootm: fix size arg of flush_cache() in bootm_load_os(). 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 Reviewed-by: Simon Glass Reviewed-by: Daniel Schwierzeck --- diff --git a/common/bootm.c b/common/bootm.c index 58936ca497..99d574db2c 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);