From: Anton Blanchard Remove the A() and AA() macros. Now we have compat_ptr we should be using that. Signed-off-by: Anton Blanchard Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/ioctl32.c | 2 -- 25-akpm/arch/ppc64/kernel/signal.c | 1 - 25-akpm/arch/ppc64/kernel/sys_ppc32.c | 16 ++++++++-------- 25-akpm/include/asm-ppc64/ppc32.h | 24 ------------------------ 4 files changed, 8 insertions(+), 35 deletions(-) diff -puN arch/ppc64/kernel/ioctl32.c~ppc64-remove-a-and-aa arch/ppc64/kernel/ioctl32.c --- 25/arch/ppc64/kernel/ioctl32.c~ppc64-remove-a-and-aa Wed Sep 15 14:06:39 2004 +++ 25-akpm/arch/ppc64/kernel/ioctl32.c Wed Sep 15 14:06:39 2004 @@ -22,9 +22,7 @@ #define INCLUDES #include "compat_ioctl.c" -#include #include -#include #define CODE #include "compat_ioctl.c" diff -puN arch/ppc64/kernel/signal.c~ppc64-remove-a-and-aa arch/ppc64/kernel/signal.c --- 25/arch/ppc64/kernel/signal.c~ppc64-remove-a-and-aa Wed Sep 15 14:06:39 2004 +++ 25-akpm/arch/ppc64/kernel/signal.c Wed Sep 15 14:06:39 2004 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff -puN arch/ppc64/kernel/sys_ppc32.c~ppc64-remove-a-and-aa arch/ppc64/kernel/sys_ppc32.c --- 25/arch/ppc64/kernel/sys_ppc32.c~ppc64-remove-a-and-aa Wed Sep 15 14:06:39 2004 +++ 25-akpm/arch/ppc64/kernel/sys_ppc32.c Wed Sep 15 14:06:39 2004 @@ -72,7 +72,6 @@ #include #include #include -#include #include #include "pci.h" @@ -700,7 +699,7 @@ asmlinkage int sys32_pciconfig_read(u32 (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) @@ -709,7 +708,7 @@ asmlinkage int sys32_pciconfig_write(u32 (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } #define IOBASE_BRIDGE_NUMBER 0 @@ -1095,7 +1094,7 @@ struct __sysctl_args32 { u32 __unused[4]; }; -extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) +asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) { struct __sysctl_args32 tmp; int error; @@ -1114,19 +1113,20 @@ extern asmlinkage long sys32_sysctl(stru glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; - if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || + if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } lock_kernel(); - error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), - oldlenp, (void __user *)A(tmp.newval), tmp.newlen); + error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, + compat_ptr(tmp.oldval), oldlenp, + compat_ptr(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { if (get_user(oldlen, oldlenp) || - put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) + put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); diff -puN include/asm-ppc64/ppc32.h~ppc64-remove-a-and-aa include/asm-ppc64/ppc32.h --- 25/include/asm-ppc64/ppc32.h~ppc64-remove-a-and-aa Wed Sep 15 14:06:39 2004 +++ 25-akpm/include/asm-ppc64/ppc32.h Wed Sep 15 14:06:39 2004 @@ -14,30 +14,6 @@ * 2 of the License, or (at your option) any later version. */ -/* Use this to get at 32-bit user passed pointers. */ -/* Things to consider: the low-level assembly stub does - srl x, 0, x for first four arguments, so if you have - pointer to something in the first four arguments, just - declare it as a pointer, not u32. On the other side, - arguments from 5th onwards should be declared as u32 - for pointers, and need AA() around each usage. - A() macro should be used for places where you e.g. - have some internal variable u32 and just want to get - rid of a compiler warning. AA() has to be used in - places where you want to convert a function argument - to 32bit pointer or when you e.g. access pt_regs - structure and want to consider 32bit registers only. - - - */ -#define A(__x) ((unsigned long)(__x)) -#define AA(__x) \ -({ unsigned long __ret; \ - __asm__ ("clrldi %0, %0, 32" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - /* These are here to support 32-bit syscalls on a 64-bit kernel. */ typedef struct compat_siginfo { _