Browse Source

[ARM] 4153/1: fix consistent_sync() off-by-one BUG check

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>
Lennert Buytenhek 18 years ago
parent
commit
3e1a80f11f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      arch/arm/mm/consistent.c

+ 1 - 1
arch/arm/mm/consistent.c

@@ -485,7 +485,7 @@ void consistent_sync(const void *start, size_t size, int direction)
 {
 {
 	const void *end = start + size;
 	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) {
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 	case DMA_FROM_DEVICE:		/* invalidate only */