Index: linux-2.6-cvs/include/asm-ia64/uaccess.h =================================================================== RCS file: /home/adsharma/disk2/cvs/linux-2.5/include/asm-ia64/uaccess.h,v retrieving revision 1.19 diff -u -r1.19 uaccess.h --- linux-2.6-cvs/include/asm-ia64/uaccess.h 27 Aug 2004 17:43:14 -0000 1.19 +++ linux-2.6-cvs/include/asm-ia64/uaccess.h 4 Oct 2004 19:28:26 -0000 @@ -67,7 +67,7 @@ #define access_ok(type, addr, size) __access_ok((addr), (size), get_fs()) static inline int -verify_area (int type, const void *addr, unsigned long size) +verify_area (int type, const void __user *addr, unsigned long size) { return access_ok(type, addr, size) ? 0 : -EFAULT; } @@ -185,7 +185,7 @@ */ #define __do_get_user(check, x, ptr, size, segment) \ ({ \ - const __typeof__(*(ptr)) *__gu_ptr = (ptr); \ + const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ __typeof__ (size) __gu_size = (size); \ long __gu_err = -EFAULT, __gu_val = 0; \ \ @@ -213,7 +213,7 @@ #define __do_put_user(check, x, ptr, size, segment) \ ({ \ __typeof__ (x) __pu_x = (x); \ - __typeof__ (*(ptr)) *__pu_ptr = (ptr); \ + __typeof__ (*(ptr)) __user *__pu_ptr = (ptr); \ __typeof__ (size) __pu_size = (size); \ long __pu_err = -EFAULT; \ \ @@ -240,31 +240,40 @@ #define __copy_from_user(to, from, n) __copy_user((to), (from), (n)) #define __copy_to_user_inatomic __copy_to_user #define __copy_from_user_inatomic __copy_from_user -#define copy_to_user(to, from, n) __copy_tofrom_user((to), (from), (n), 1) -#define copy_from_user(to, from, n) __copy_tofrom_user((to), (from), (n), 0) -#define __copy_tofrom_user(to, from, n, check_to) \ +#define copy_to_user(to, from, n) \ ({ \ - void *__cu_to = (to); \ + void __user *__cu_to = (to); \ const void *__cu_from = (from); \ long __cu_len = (n); \ \ - if (__access_ok((long) ((check_to) ? __cu_to : __cu_from), __cu_len, get_fs())) \ - __cu_len = __copy_user(__cu_to, __cu_from, __cu_len); \ + if (__access_ok((long) __cu_to, __cu_len, get_fs())) \ + __cu_len = __copy_user((void *) __cu_to, __cu_from, __cu_len); \ + __cu_len; \ +}) + +#define copy_from_user(to, from, n) \ +({ \ + void *__cu_to = (to); \ + const void __user *__cu_from = (from); \ + long __cu_len = (n); \ + \ + if (__access_ok((long) __cu_from, __cu_len, get_fs())) \ + __cu_len = __copy_user(__cu_to, (const void *) __cu_from, __cu_len); \ __cu_len; \ }) #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) static inline unsigned long -copy_in_user (void *to, const void *from, unsigned long n) +copy_in_user (void *to, const void __user *from, unsigned long n) { if (likely(access_ok(VERIFY_READ, from, n) && access_ok(VERIFY_WRITE, to, n))) n = __copy_user(to, from, n); return n; } -extern unsigned long __do_clear_user (void *, unsigned long); +extern unsigned long __do_clear_user (void __user *, unsigned long); #define __clear_user(to, n) __do_clear_user(to, n) @@ -281,11 +290,11 @@ * Returns: -EFAULT if exception before terminator, N if the entire buffer filled, else * strlen. */ -extern long __strncpy_from_user (char *to, const char *from, long to_len); +extern long __strncpy_from_user (char *to, const char __user *from, long to_len); #define strncpy_from_user(to, from, n) \ ({ \ - const char * __sfu_from = (from); \ + const char __user * __sfu_from = (from); \ long __sfu_ret = -EFAULT; \ if (__access_ok((long) __sfu_from, 0, get_fs())) \ __sfu_ret = __strncpy_from_user((to), __sfu_from, (n)); \ @@ -293,11 +302,11 @@ }) /* Returns: 0 if bad, string length+1 (memory size) of string if ok */ -extern unsigned long __strlen_user (const char *); +extern unsigned long __strlen_user (const char __user *); #define strlen_user(str) \ ({ \ - const char *__su_str = (str); \ + const char __user *__su_str = (str); \ unsigned long __su_ret = 0; \ if (__access_ok((long) __su_str, 0, get_fs())) \ __su_ret = __strlen_user(__su_str); \ @@ -309,7 +318,7 @@ * (N), a value greater than N if the limit would be exceeded, else * strlen. */ -extern unsigned long __strnlen_user (const char *, long); +extern unsigned long __strnlen_user (const char __user *, long); #define strnlen_user(str, len) \ ({ \