• Russell King's avatar
    [ARM] Fix virtual to physical translation macro corner cases · 1522ac3e
    Russell King authored
    The current use of these macros works well when the conversion is
    entirely linear.  In this case, we can be assured that the following
    holds true:
    
    	__va(p + s) - s = __va(p)
    
    However, this is not always the case, especially when there is a
    non-linear conversion (eg, when there is a 3.5GB hole in memory.)
    In this case, if 's' is the size of the region (eg, PAGE_SIZE) and
    'p' is the final page, the above is most definitely not true.
    
    So, we must ensure that __va() and __pa() are only used with valid
    kernel direct mapped RAM addresses.  This patch tweaks the code
    to achieve this.
    Tested-by: default avatarCharles Moschel <fred99@carolina.rr.com>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    1522ac3e
mmap.c 3.35 KB