* Fix zero length sys_cacheflush
@ 2005-10-19 10:57 Atsushi Nemoto
2005-10-19 13:29 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2005-10-19 10:57 UTC (permalink / raw)
To: linux-mips; +Cc: ralf
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;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Fix zero length sys_cacheflush
2005-10-19 10:57 Fix zero length sys_cacheflush Atsushi Nemoto
@ 2005-10-19 13:29 ` Ralf Baechle
2005-10-19 14:22 ` Atsushi Nemoto
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2005-10-19 13:29 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips
On Wed, Oct 19, 2005 at 07:57:14PM +0900, Atsushi Nemoto wrote:
> 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).
Applied,
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix zero length sys_cacheflush
2005-10-19 13:29 ` Ralf Baechle
@ 2005-10-19 14:22 ` Atsushi Nemoto
2005-10-19 15:57 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2005-10-19 14:22 UTC (permalink / raw)
To: ralf; +Cc: linux-mips
>>>>> On Wed, 19 Oct 2005 14:29:02 +0100, Ralf Baechle <ralf@linux-mips.org> said:
>> 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).
ralf> Applied,
Thanks.
BTW, sparse complains for this "unsigned long __user addr".
asmlinkage int sys_cacheflush(unsigned long __user addr,
unsigned long bytes, unsigned int cache)
/work/git/linux-mips/arch/mips/mm/cache.c:59:7: warning: dereference of noderef expression
I suppose the "unsigned long __user addr" means that the "addr"
variable itself is an userspace object. So its usage is wrong, isn't
it?
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix zero length sys_cacheflush
2005-10-19 14:22 ` Atsushi Nemoto
@ 2005-10-19 15:57 ` Ralf Baechle
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2005-10-19 15:57 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips
On Wed, Oct 19, 2005 at 11:22:22PM +0900, Atsushi Nemoto wrote:
> BTW, sparse complains for this "unsigned long __user addr".
>
> asmlinkage int sys_cacheflush(unsigned long __user addr,
> unsigned long bytes, unsigned int cache)
>
> /work/git/linux-mips/arch/mips/mm/cache.c:59:7: warning: dereference of noderef expression
>
> I suppose the "unsigned long __user addr" means that the "addr"
> variable itself is an userspace object. So its usage is wrong, isn't
> it?
It didn't complain about this use in the past. Anyway, time to do another
pass with sparse over the code; sparse developers have invented alot of new
creative warnings ;-)
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-19 15:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-19 10:57 Fix zero length sys_cacheflush Atsushi Nemoto
2005-10-19 13:29 ` Ralf Baechle
2005-10-19 14:22 ` Atsushi Nemoto
2005-10-19 15:57 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox