diff options
author | Marian Balakowicz <m8@semihalf.com> | 2008-01-31 13:20:06 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-02-07 01:12:57 +0100 |
commit | 7582438c285bf0cef82909d0f232de64ec567a8a (patch) | |
tree | 7f4b2b137dd500e005d14f3594fefefe58ec64fd /lib_ppc | |
parent | f13e7b2e993c61fed1f607962501e051940d6e80 (diff) | |
download | u-boot-imx-7582438c285bf0cef82909d0f232de64ec567a8a.zip u-boot-imx-7582438c285bf0cef82909d0f232de64ec567a8a.tar.gz u-boot-imx-7582438c285bf0cef82909d0f232de64ec567a8a.tar.bz2 |
[new uImage] Return error on image move/uncompress overwrites
Check for overwrites during image move/uncompress, return with error
when the original image gets corrupted. Report clear message to the user
and prevent further troubles when pointer to the corrupted images is passed
to do_bootm_linux routine.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'lib_ppc')
-rw-r--r-- | lib_ppc/ppc_linux.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib_ppc/ppc_linux.c b/lib_ppc/ppc_linux.c index 0a625fc..3911687 100644 --- a/lib_ppc/ppc_linux.c +++ b/lib_ppc/ppc_linux.c @@ -23,6 +23,8 @@ * MA 02111-1307 USA */ +#define DEBUG + #include <common.h> #include <watchdog.h> #include <command.h> @@ -259,11 +261,19 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, of_data = (ulong)of_flat_tree; #endif } else if (image_check_magic (fdt_hdr)) { + ulong image_start, image_end; + ulong load_start, load_end; + printf ("## Flat Device Tree at %08lX\n", fdt_hdr); print_image_hdr (fdt_hdr); - if ((image_get_load (fdt_hdr) < image_get_image_end (fdt_hdr)) && - ((image_get_load (fdt_hdr) + image_get_data_size (fdt_hdr)) > (unsigned long)fdt_hdr)) { + image_start = (ulong)fdt_hdr; + image_end = image_get_image_end (fdt_hdr); + + load_start = image_get_load (fdt_hdr); + load_end = load_start + image_get_data_size (fdt_hdr); + + if ((load_start < image_end) && (load_end > image_start)) { puts ("ERROR: fdt overwritten - " "must RESET the board to recover.\n"); do_reset (cmdtp, flag, argc, argv); |