[ARM] 4153/1: fix consistent_sync() off-by-one BUG check
authorLennert Buytenhek <buytenh@wantstofly.org>
Thu, 8 Feb 2007 15:26:23 +0000 (16:26 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 8 Feb 2007 15:29:00 +0000 (15:29 +0000)
In consistent_sync(), start + size can end up pointing one byte
beyond the end of the direct RAM mapping.  We shouldn't BUG() when
this happens.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/consistent.c

index 166aee13c4b1bd40e963e6b14132796d04aec757..1f9f94f9af4bac8d99137cad55204afcc279c0e4 100644 (file)
@@ -485,7 +485,7 @@ void consistent_sync(const void *start, size_t size, int direction)
 {
        const void *end = start + size;
 
-       BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end));
+       BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end - 1));
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */