linux-mips
[Top] [All Lists]

Fix zero length sys_cacheflush

To: linux-mips@linux-mips.org
Subject: Fix zero length sys_cacheflush
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Wed, 19 Oct 2005 19:57:14 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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 <anemo@mba.ocn.ne.jp>

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>