Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1284037 > unrolled thread

Re: [PATCH] of: Fix comparison of reserved memory regions

Started byMitchel Humpherys <mitchelh@codeaurora.org>
First post2015-12-04 18:10 +0100
Last post2015-12-07 00:40 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] of: Fix comparison of reserved memory regions Mitchel Humpherys <mitchelh@codeaurora.org> - 2015-12-04 18:10 +0100
    Re: [PATCH] of: Fix comparison of reserved memory regions Michael Ellerman <michael@ellerman.id.au> - 2015-12-05 12:50 +0100
      Re: [PATCH] of: Fix comparison of reserved memory regions Rob Herring <robh+dt@kernel.org> - 2015-12-06 21:40 +0100
        Re: [PATCH] of: Fix comparison of reserved memory regions Michael Ellerman <mpe@ellerman.id.au> - 2015-12-07 00:40 +0100

#1284037 — Re: [PATCH] of: Fix comparison of reserved memory regions

FromMitchel Humpherys <mitchelh@codeaurora.org>
Date2015-12-04 18:10 +0100
SubjectRe: [PATCH] of: Fix comparison of reserved memory regions
Message-ID<qC21R-5zk-51@gated-at.bofh.it>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1284534

FromMichael Ellerman <michael@ellerman.id.au>
Date2015-12-05 12:50 +0100
Message-ID<qCjvH-vV-11@gated-at.bofh.it>
In reply to#1284037

On 5 December 2015 04:07:39 GMT+11:00, Mitchel Humpherys <mitchelh@codeaurora.org> wrote:
>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>

Thanks for testing.

Rob, can we get this merged for 4.4 please?

cheers 

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1284909

FromRob Herring <robh+dt@kernel.org>
Date2015-12-06 21:40 +0100
Message-ID<qCOga-3iC-5@gated-at.bofh.it>
In reply to#1284534
On Sat, Dec 5, 2015 at 5:43 AM, Michael Ellerman <michael@ellerman.id.au> wrote:
>
>
> On 5 December 2015 04:07:39 GMT+11:00, Mitchel Humpherys <mitchelh@codeaurora.org> wrote:
>>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>
>
> Thanks for testing.
>
> Rob, can we get this merged for 4.4 please?

Yes. I meant to last week, but was waiting on getting another issue
sorted out. I should get it to Linus in the next couple of days.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1284944

FromMichael Ellerman <mpe@ellerman.id.au>
Date2015-12-07 00:40 +0100
Message-ID<qCR4n-54U-31@gated-at.bofh.it>
In reply to#1284909
On Sun, 2015-12-06 at 14:31 -0600, Rob Herring wrote:
> On Sat, Dec 5, 2015 at 5:43 AM, Michael Ellerman <michael@ellerman.id.au> wrote:
> > On 5 December 2015 04:07:39 GMT+11:00, Mitchel Humpherys <mitchelh@codeaurora.org> wrote:
> > > On Wed, Nov 18 2015 at 09:46:38 PM, Michael Ellerman
> > > <mpe@ellerman.id.au> wrote:
> > > > Fix it by just doing the standard double if and return 0 logic.
> > > > 
> > > > Fixes: ae1add247bf8 ("of: Check for overlap in reserved memory
> > > regions")
> > > 
> > > Woops, thanks.
> > > 
> > > Tested-by: Mitchel Humpherys <mitchelh@codeaurora.org>
> > 
> > Thanks for testing.
> > 
> > Rob, can we get this merged for 4.4 please?
> 
> Yes. I meant to last week, but was waiting on getting another issue
> sorted out. I should get it to Linus in the next couple of days.

Sure thing. No great rush but would be nice for it to be fixed before 4.4
releases.

cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web