From be8a637d285e8ba98eeb3bb537fead50794634cb Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Fri, 2 Oct 2009 00:45:28 +0100 Subject: [PATCH] ARM: 5740/1: fix valid_phys_addr_range() range check Commit 881cf5ba145f1c661c3cb0caeb02448d35211146 ("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 Signed-off-by: Russell King --- arch/arm/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index f7457fea6de8e..2b7996401b0f9 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; -- 2.39.5