From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [rfc] warning about overlapping regions when booting with bootm
Date: Sat, 16 Feb 2008 02:59:32 -0500 [thread overview]
Message-ID: <200802160259.32371.vapier@gentoo.org> (raw)
we semi-frequently get users who try to boot an image on top of itself and
when when things crash, dont realize why. i put together this quick little
warning, but i'm guessing that Wolfgang's answer is "don't bloat the code for
stupid people" ...
--- common/cmd_bootm.c
+++ common/cmd_bootm.c
@@ -1434,6 +1439,16 @@ int gunzip(void *dst, int dstlen, unsign
z_stream s;
int r, i, flags;
+ /* If memory regions overlap, whine about it. We cannot check
+ * the dstlen value as it is usually set to the max possible value
+ * (CFG_BOOTM_LEN) which can be huge (64M). Instead, we'll assume
+ * the decompression size will be at least as big as the compressed
+ * size so that we can at least check part of the destination.
+ */
+ if ((dst <= (void *)src && (void *)src < dst + /*dstlen*/ *lenp) ||
+ (dst <= (void *)(src + *lenp) && (void *)(src + *lenp) < dst + /*dstlen*/ *lenp))
+ puts ("\n Warning: src and dst regions overlap ... ");
+
/* skip header */
i = 10;
flags = src[3];
-mike
next reply other threads:[~2008-02-16 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-16 7:59 Mike Frysinger [this message]
2008-02-16 23:06 ` [U-Boot-Users] [rfc] warning about overlapping regions when booting with bootm Wolfgang Denk
2008-02-16 23:19 ` Mike Frysinger
2008-02-17 20:29 ` [U-Boot-Users] [rfc] warning about overlapping regions whenbooting " Robin Getz
2008-02-17 22:09 ` Wolfgang Denk
2008-02-17 22:55 ` Robin Getz
2008-02-22 17:49 ` Marian Balakowicz
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=200802160259.32371.vapier@gentoo.org \
--to=vapier@gentoo.org \
--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