linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: fix valid_phys_addr_range() range check
@ 2009-09-24  6:24 Greg Ungerer
  2009-10-01 15:04 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Ungerer @ 2009-09-24  6:24 UTC (permalink / raw)
  To: linux-arm-kernel

arm: fix valid_phys_addr_range() range check

Commit 1522ac3ec95ff0230e7aa516f86b674fdf72866c
("Fix virtual to physical translation macro corner cases")
breaks the end of memory check in valid_phys_addr_range().
The modified expression results in the apparent /dev/mem size
being 2 bytes smaller than what it actually is.

This patch reworks the expression to correctly check the address,
while maintaining use of a valid address to __pa().

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
---
 arch/arm/mm/mmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index f7457fe..2b79964 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -124,7 +124,7 @@ int valid_phys_addr_range(unsigned long addr, size_t size)
 {
 	if (addr < PHYS_OFFSET)
 		return 0;
-	if (addr + size >= __pa(high_memory - 1))
+	if (addr + size > __pa(high_memory - 1) + 1)
 		return 0;
 
 	return 1;
-- 
1.5.5.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm: fix valid_phys_addr_range() range check
  2009-09-24  6:24 [PATCH] arm: fix valid_phys_addr_range() range check Greg Ungerer
@ 2009-10-01 15:04 ` Russell King - ARM Linux
  2009-10-02  0:28   ` Greg Ungerer
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2009-10-01 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 24, 2009 at 04:24:04PM +1000, Greg Ungerer wrote:
> arm: fix valid_phys_addr_range() range check
> 
> Commit 1522ac3ec95ff0230e7aa516f86b674fdf72866c
> ("Fix virtual to physical translation macro corner cases")
> breaks the end of memory check in valid_phys_addr_range().
> The modified expression results in the apparent /dev/mem size
> being 2 bytes smaller than what it actually is.
> 
> This patch reworks the expression to correctly check the address,
> while maintaining use of a valid address to __pa().

Looks good, can you please send it to the patch system?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm: fix valid_phys_addr_range() range check
  2009-10-01 15:04 ` Russell King - ARM Linux
@ 2009-10-02  0:28   ` Greg Ungerer
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Ungerer @ 2009-10-02  0:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

Russell King - ARM Linux wrote:
> On Thu, Sep 24, 2009 at 04:24:04PM +1000, Greg Ungerer wrote:
>> arm: fix valid_phys_addr_range() range check
>>
>> Commit 1522ac3ec95ff0230e7aa516f86b674fdf72866c
>> ("Fix virtual to physical translation macro corner cases")
>> breaks the end of memory check in valid_phys_addr_range().
>> The modified expression results in the apparent /dev/mem size
>> being 2 bytes smaller than what it actually is.
>>
>> This patch reworks the expression to correctly check the address,
>> while maintaining use of a valid address to __pa().
> 
> Looks good, can you please send it to the patch system?

Done, patch 5740/1.

Thanks
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg at snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-02  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24  6:24 [PATCH] arm: fix valid_phys_addr_range() range check Greg Ungerer
2009-10-01 15:04 ` Russell King - ARM Linux
2009-10-02  0:28   ` Greg Ungerer

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).