[Top] [All Lists]

Fix zero length sys_cacheflush

Subject: Fix zero length sys_cacheflush
From: Atsushi Nemoto <>
Date: Wed, 19 Oct 2005 19:57:14 +0900 (JST)
Original-recipient: rfc822;
I found cacheflush(0, 0, 0) will crash the system.

This is because flush_icache_range(start, end) tries to flushing whole
address space (0 - ffffffff) if both start and end are zero (at least
in c-r4k.c).

Signed-off-by: Atsushi Nemoto <>

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -56,6 +56,8 @@ EXPORT_SYMBOL(_dma_cache_inv);
 asmlinkage int sys_cacheflush(unsigned long __user addr,
        unsigned long bytes, unsigned int cache)
+       if (bytes == 0)
+               return 0;
        if (!access_ok(VERIFY_WRITE, (void __user *) addr, bytes))
                return -EFAULT;

<Prev in Thread] Current Thread [Next in Thread>