devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Grant Likely <grant.likely@linaro.org>, devicetree@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] of: fdt: fix memory range check
Date: Wed, 24 Sep 2014 15:51:00 +0100	[thread overview]
Message-ID: <5422DA54.4020806@linaro.org> (raw)
In-Reply-To: <20140924143844.B2218C40738@trevor.secretlab.ca>



On 24/09/14 15:38, Grant Likely wrote:
>> --- 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:
Thanks for fixing this too.
>
> 		pr_warning("Ignoring memory range 0x%lx - 0x%llx\n",
> 				MAX_PHYS_ADDR + 1, base + size);

I think the first argument should be printed in 0x%llx format as there 
would be a 32bit overflow for MAX_PHYS_ADDR + 1.

> 		size = MAX_PHYS_ADDR - base + 1;
>
> I've fixed it up and applied, thanks.

--srini

      reply	other threads:[~2014-09-24 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  9:59 [PATCH] of: fdt: fix memory range check Srinivas Kandagatla
2014-09-24 14:38 ` Grant Likely
2014-09-24 14:51   ` Srinivas Kandagatla [this message]

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=5422DA54.4020806@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).