U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc: unused memory region too close to current stack pointer
Date: Fri, 19 Mar 2010 15:34:25 +0100	[thread overview]
Message-ID: <201003191434.o2JEYPRF024813@linpc062.aimsys.nl> (raw)


This avoids a possible overwrite of the (end of) ramdisk by u-boot.
The unused memory region for ppc boot currently starts 1k below the
do_bootm->bootm_start->arch_lmb_reserve stack ptr. This isn't enough since
do_bootm->do_bootm_linux->boot_relocate_fdt calls printf which may
very well use more than 1k stack space.

diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 0685a93..6702df5 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -163,8 +163,8 @@ void arch_lmb_reserve(struct lmb *lmb)
 	sp = get_sp();
 	debug ("## Current stack ends at 0x%08lx\n", sp);
 
-	/* adjust sp by 1K to be safe */
-	sp -= 1024;
+	/* adjust sp by 4K to be safe */
+	sp -= 4096;
 	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp));
 
 	return ;
-- 
1.5.2.2

Signed-off-by: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>

             reply	other threads:[~2010-03-19 14:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 14:34 Norbert van Bolhuis [this message]
2010-05-05 21:56 ` [U-Boot] [PATCH] ppc: unused memory region too close to current stack pointer Wolfgang Denk

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=201003191434.o2JEYPRF024813@linpc062.aimsys.nl \
    --to=nvbolhuis@aimvalley.nl \
    --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