From: Andrew Morton - Coding style fixes - __user annotation - avoid pointless get_cpu()/put_cpu(). Cc: Andi Kleen Signed-off-by: Andrew Morton --- include/linux/syscalls.h | 3 ++- kernel/sys.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff -puN include/linux/syscalls.h~mm-x86_64-mm-generic-getcpu-syscall-tweaks include/linux/syscalls.h --- a/include/linux/syscalls.h~mm-x86_64-mm-generic-getcpu-syscall-tweaks +++ a/include/linux/syscalls.h @@ -597,6 +597,7 @@ asmlinkage long sys_get_robust_list(int size_t __user *len_ptr); asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, size_t len); -asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *cache); +asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, + struct getcpu_cache *cache); #endif diff -puN kernel/sys.c~mm-x86_64-mm-generic-getcpu-syscall-tweaks kernel/sys.c --- a/kernel/sys.c~mm-x86_64-mm-generic-getcpu-syscall-tweaks +++ a/kernel/sys.c @@ -2064,21 +2064,25 @@ asmlinkage long sys_prctl(int option, un return error; } -asmlinkage long sys_getcpu(unsigned *cpup, unsigned *nodep, struct getcpu_cache *cache) +asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, + struct getcpu_cache __user *cache) { int err = 0; - int cpu = get_cpu(); - put_cpu(); + int cpu = raw_smp_processor_id(); + if (cpup) err |= put_user(cpu, cpup); if (nodep) err |= put_user(cpu_to_node(cpu), nodep); if (cache) { - /* Not needed for this implementation, but make sure user programs pass - something valid. We only use t0 and t1 because these are available in both - 32bit and 64bit ABI (no need for a compat_getcpu). 32bit has enough - padding. */ + /* + * Not needed for this implementation, but make sure user + * programs pass something valid. We only use t0 and t1 because + * these are available in both 32bit and 64bit ABI (no need for + * a compat_getcpu). 32bit has enough padding. + */ unsigned long t0, t1; + get_user(t0, &cache->t0); get_user(t1, &cache->t1); t0++; _