Linux MIPS Architecture development
 help / color / mirror / Atom feed
* mips64 _access_ok fix
@ 2003-09-11  3:43 Atsushi Nemoto
  2003-09-11  4:43 ` Atsushi Nemoto
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2003-09-11  3:43 UTC (permalink / raw)
  To: linux-mips

The mips64 _access_ok macro in 2.4 tree returns 0 if 'addr' + 'size'
== TASK_SIZE.

Also, __ua_size macro returus 0 if 'size' is negative constant.  I
think we must not skip checking negative constant.

Here is a fix.  For 2.6 tree, only _access_ok fix will be needed
(__ua_size is already fixed).

diff -u linux-mips-cvs/include/asm-mips64/uaccess.h linux.new/include/asm-mips64/uaccess.h
--- linux-mips-cvs/include/asm-mips64/uaccess.h	Tue Jul 15 20:21:59 2003
+++ linux.new/include/asm-mips64/uaccess.h	Thu Sep 11 12:29:08 2003
@@ -46,10 +46,10 @@
  *  - OR we are in kernel mode.
  */
 #define __ua_size(size)							\
-	((__builtin_constant_p(size) && (size)) > 0 ? 0 : (size))
+	(__builtin_constant_p(size) && (signed long) (size) > 0 ? 0 : (size))
 
 #define __access_ok(addr, size, mask)					\
-	(((mask) & ((addr) | ((addr) + (size)) | __ua_size(size))) == 0)
+	(((mask) & ((addr) | ((addr) + (size) - 1) | __ua_size(size))) == 0)
 
 #define __access_mask get_fs().seg
 
---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-09-12  0:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-11  3:43 mips64 _access_ok fix Atsushi Nemoto
2003-09-11  4:43 ` Atsushi Nemoto
2003-09-11 14:16   ` Ralf Baechle
2003-09-12  0:34     ` Atsushi Nemoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox