From: Mitchel Humpherys <mitchelh@codeaurora.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: robh+dt@kernel.org, devicetree@vger.kernel.org,
<linux-kernel@vger.kernel.org>, <linuxppc-dev@ozlabs.org>,
frowand.list@gmail.com, grant.likely@linaro.org
Subject: Re: [PATCH] of: Fix comparison of reserved memory regions
Date: Fri, 04 Dec 2015 09:07:39 -0800 [thread overview]
Message-ID: <vnkwk2oum9b8.fsf@codeaurora.org> (raw)
In-Reply-To: <1447843598-9355-1-git-send-email-mpe@ellerman.id.au> (Michael Ellerman's message of "Wed, 18 Nov 2015 21:46:38 +1100")
On Wed, Nov 18 2015 at 09:46:38 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> In order to check for overlapping reserved memory regions, we first need
> to sort the array of memory regions. This is implemented using sort(),
> and a custom comparison function __rmem_cmp().
>
> Unfortunatley __rmem_cmp() doesn't work in all cases. Because the two
> base values are phys_addr_t, they may be u64 on some platforms, in which
> case subtracting one from the other and then (implicitly) casting to int
> does not give us the -ve/0/+ve value we need.
>
> This leads to incorrect reports about overlaps, eg:
>
> ibm,slw-image@1ffe600000 (0x0000001ffe600000--0x0000001ffe700000) overlaps with
> ibm,firmware-allocs-memory@1000000000 (0x0000001000000000--0x0000001000dc0200)
>
> Fix it by just doing the standard double if and return 0 logic.
>
> Fixes: ae1add247bf8 ("of: Check for overlap in reserved memory regions")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> drivers/of/of_reserved_mem.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Woops, thanks.
Tested-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-Mitch
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
WARNING: multiple messages have this Message-ID (diff)
From: Mitchel Humpherys <mitchelh@codeaurora.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: robh+dt@kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
frowand.list@gmail.com, grant.likely@linaro.org
Subject: Re: [PATCH] of: Fix comparison of reserved memory regions
Date: Fri, 04 Dec 2015 09:07:39 -0800 [thread overview]
Message-ID: <vnkwk2oum9b8.fsf@codeaurora.org> (raw)
In-Reply-To: <1447843598-9355-1-git-send-email-mpe@ellerman.id.au> (Michael Ellerman's message of "Wed, 18 Nov 2015 21:46:38 +1100")
On Wed, Nov 18 2015 at 09:46:38 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> In order to check for overlapping reserved memory regions, we first need
> to sort the array of memory regions. This is implemented using sort(),
> and a custom comparison function __rmem_cmp().
>
> Unfortunatley __rmem_cmp() doesn't work in all cases. Because the two
> base values are phys_addr_t, they may be u64 on some platforms, in which
> case subtracting one from the other and then (implicitly) casting to int
> does not give us the -ve/0/+ve value we need.
>
> This leads to incorrect reports about overlaps, eg:
>
> ibm,slw-image@1ffe600000 (0x0000001ffe600000--0x0000001ffe700000) overlaps with
> ibm,firmware-allocs-memory@1000000000 (0x0000001000000000--0x0000001000dc0200)
>
> Fix it by just doing the standard double if and return 0 logic.
>
> Fixes: ae1add247bf8 ("of: Check for overlap in reserved memory regions")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> drivers/of/of_reserved_mem.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Woops, thanks.
Tested-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-Mitch
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-12-04 17:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 10:46 [PATCH] of: Fix comparison of reserved memory regions Michael Ellerman
2015-11-18 10:46 ` Michael Ellerman
2015-12-04 17:07 ` Mitchel Humpherys [this message]
2015-12-04 17:07 ` Mitchel Humpherys
2015-12-05 11:43 ` Michael Ellerman
2015-12-05 11:43 ` Michael Ellerman
2015-12-06 20:31 ` Rob Herring
2015-12-06 20:31 ` Rob Herring
2015-12-06 23:33 ` Michael Ellerman
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=vnkwk2oum9b8.fsf@codeaurora.org \
--to=mitchelh@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=grant.likely@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.