From: Grant Likely <grant.likely@linaro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
devicetree@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>,
linux-kernel@vger.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: Re: [PATCH] of: fdt: fix memory range check
Date: Wed, 24 Sep 2014 15:38:44 +0100 [thread overview]
Message-ID: <20140924143844.B2218C40738@trevor.secretlab.ca> (raw)
In-Reply-To: <1411466349-14166-1-git-send-email-srinivas.kandagatla@linaro.org>
On Tue, 23 Sep 2014 10:59:09 +0100, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote:
> In cases where board has below memory DT node
>
> memory{
> device_type = "memory";
> reg = <0x80000000 0x80000000>;
> };
>
> Check on the memory range in fdt.c will always fail because it is
> comparing MAX_PHYS_ADDR with base + size, in fact it should compare
> it with base + size - 1.
>
> This issue was originally noticed on Qualcomm IFC6410 board.
> Without this patch kernel shows up noticed unnecessary warnings
>
> [ 0.000000] Machine model: Qualcomm APQ8064/IFC6410
> [ 0.000000] Ignoring memory range 0xffffffff - 0x100000000
> [ 0.000000] cma: Reserved 64 MiB at ab800000
>
> as a result the size get reduced to 0x7fffffff which looks wrong.
>
> This patch fixes the check involved in generating this warning and
> as a result it also fixes the wrong size calculation.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> drivers/of/fdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 79cb831..3f5736c 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -937,7 +937,7 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
> return;
> }
>
> - if (base + size > MAX_PHYS_ADDR) {
> + if (base + size - 1 > MAX_PHYS_ADDR) {
> pr_warning("Ignoring memory range 0x%lx - 0x%llx\n",
> ULONG_MAX, base + size);
> size = MAX_PHYS_ADDR - base;
By that logic, the above two lines need to be repaired also:
pr_warning("Ignoring memory range 0x%lx - 0x%llx\n",
MAX_PHYS_ADDR + 1, base + size);
size = MAX_PHYS_ADDR - base + 1;
I've fixed it up and applied, thanks.
g.
next prev parent reply other threads:[~2014-09-24 14:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 9:59 Srinivas Kandagatla
2014-09-24 14:38 ` Grant Likely [this message]
2014-09-24 14:51 ` Srinivas Kandagatla
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=20140924143844.B2218C40738@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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
all inboxes | Powered by JetHome®