Skip to content

Commit

Permalink
ARM: 5740/1: fix valid_phys_addr_range() range check
Browse files Browse the repository at this point in the history
Commit 1522ac3
("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 <[email protected]>
Signed-off-by: Russell King <[email protected]>
  • Loading branch information
Greg Ungerer authored and Russell King committed Oct 2, 2009
1 parent 31abdb7 commit 6806bfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6806bfe

Please sign in to comment.