From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lib: lmb: fix overflow in __lmb_alloc_base w/ large RAM
Date: Wed, 06 Aug 2014 10:03:13 -0600 [thread overview]
Message-ID: <53E251C1.5040601@wwwdotorg.org> (raw)
In-Reply-To: <1406835607-14879-1-git-send-email-swarren@wwwdotorg.org>
On 07/31/2014 01:40 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> If a 32-bit system has 2GB of RAM, and the base address of that RAM is
> 2GB, then start+size will overflow a 32-bit value (to a value of 0).
>
> __lmb_alloc_base is affected by this; it calculates the minimum of
> (start+size of RAM) and max_addr. However, when start+size is 0, it
> is always less than max_addr, which causes the value of max_addr not
> to be taken into account when restricting the allocation's location.
>
> Fix this by calculating start+size separately, and if that calculation
> underflows, using -1 (interpreted as the max unsigned value) as the
> value instead, and then taking the min of that and max_addr. Now that
> start+size doesn't overflow, it's typically large, and max_addr
> dominates the min() call, and is taken into account.
>
> The user-visible symptom of this bug is that CONFIG_BOOTMAP_SZ is ignored
> on Tegra124 systems with 2GB of RAM, which in turn causes the DT to be
> relocated at the very end of RAM, which the ARM Linux kernel doesn't map
> during early boot, and which causes boot failures. With this fix,
> CONFIG_BOOTMAP_SZ correctly restricts the relocated DT to a much lower
> address, and everything works.
TomR,
Does this patch look OK to you? I imagine that TomW is holding off
applying "ARM: tegra: Use mem size from MC rather than ODMDATA" since it
depends on this patch, which isn't applied yet.
Thanks.
next prev parent reply other threads:[~2014-08-06 16:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 19:40 [U-Boot] [PATCH] lib: lmb: fix overflow in __lmb_alloc_base w/ large RAM Stephen Warren
2014-08-06 16:03 ` Stephen Warren [this message]
2014-08-10 22:23 ` [U-Boot] " Tom Rini
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=53E251C1.5040601@wwwdotorg.org \
--to=swarren@wwwdotorg.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