Commit 37dbd1af authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sparse: user annotations for s390 architecture

From: Arnd Bergmann <arnd@arndb.de>

Lots of trivial changes to make sparse happy on s390 arch code, mostly
__user annotations.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d4cdd487
...@@ -53,7 +53,7 @@ typedef struct ...@@ -53,7 +53,7 @@ typedef struct
asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from) int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from)
{ {
int err; int err;
...@@ -130,7 +130,8 @@ sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t ...@@ -130,7 +130,8 @@ sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t
} }
asmlinkage int asmlinkage int
sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize) sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset,
size_t sigsetsize)
{ {
sigset_t saveset, newset; sigset_t saveset, newset;
compat_sigset_t set32; compat_sigset_t set32;
...@@ -162,11 +163,11 @@ sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigse ...@@ -162,11 +163,11 @@ sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigse
if (do_signal(regs, &saveset)) if (do_signal(regs, &saveset))
return -EINTR; return -EINTR;
} }
} }
asmlinkage long asmlinkage long
sys32_sigaction(int sig, const struct old_sigaction32 *act, sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
struct old_sigaction32 *oact) struct old_sigaction32 __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -199,9 +200,9 @@ sys32_sigaction(int sig, const struct old_sigaction32 *act, ...@@ -199,9 +200,9 @@ sys32_sigaction(int sig, const struct old_sigaction32 *act,
int int
do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact); do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
asmlinkage long asmlinkage long
sys32_rt_sigaction(int sig, const struct sigaction32 *act, sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
struct sigaction32 *oact, size_t sigsetsize) struct sigaction32 __user *oact, size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -258,7 +259,8 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act, ...@@ -258,7 +259,8 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act,
} }
asmlinkage long asmlinkage long
sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss,
struct pt_regs *regs)
{ {
stack_t kss, koss; stack_t kss, koss;
int ret, err = 0; int ret, err = 0;
...@@ -275,7 +277,9 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) ...@@ -275,7 +277,9 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
} }
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]); ret = do_sigaltstack((stack_t __user *) (uss ? &kss : NULL),
(stack_t __user *) (uoss ? &koss : NULL),
regs->gprs[15]);
set_fs (old_fs); set_fs (old_fs);
if (!ret && uoss) { if (!ret && uoss) {
...@@ -290,7 +294,7 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) ...@@ -290,7 +294,7 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
return ret; return ret;
} }
static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
{ {
_s390_regs_common32 regs32; _s390_regs_common32 regs32;
int err, i; int err, i;
...@@ -311,7 +315,7 @@ static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) ...@@ -311,7 +315,7 @@ static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
sizeof(_s390_fp_regs32)); sizeof(_s390_fp_regs32));
} }
static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
{ {
_s390_regs_common32 regs32; _s390_regs_common32 regs32;
int err, i; int err, i;
...@@ -343,7 +347,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) ...@@ -343,7 +347,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
asmlinkage long sys32_sigreturn(struct pt_regs *regs) asmlinkage long sys32_sigreturn(struct pt_regs *regs)
{ {
sigframe32 *frame = (sigframe32 *)regs->gprs[15]; sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
...@@ -365,11 +369,11 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs) ...@@ -365,11 +369,11 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs)
badframe: badframe:
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
return 0; return 0;
} }
asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
{ {
rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15]; rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
sigset_t set; sigset_t set;
stack_t st; stack_t st;
__u32 ss_sp; __u32 ss_sp;
...@@ -399,8 +403,8 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) ...@@ -399,8 +403,8 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
/* It is more difficult to avoid calling this function than to /* It is more difficult to avoid calling this function than to
call it and ignore errors. */ call it and ignore errors. */
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
do_sigaltstack(&st, NULL, regs->gprs[15]); do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]);
set_fs (old_fs); set_fs (old_fs);
return regs->gprs[2]; return regs->gprs[2];
...@@ -418,7 +422,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) ...@@ -418,7 +422,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
/* /*
* Determine which stack to use.. * Determine which stack to use..
*/ */
static inline void * static inline void __user *
get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
{ {
unsigned long sp; unsigned long sp;
...@@ -439,7 +443,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) ...@@ -439,7 +443,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
sp = (unsigned long) ka->sa.sa_restorer; sp = (unsigned long) ka->sa.sa_restorer;
} }
return (void *)((sp - frame_size) & -8ul); return (void __user *)((sp - frame_size) & -8ul);
} }
static inline int map_signal(int sig) static inline int map_signal(int sig)
...@@ -455,7 +459,7 @@ static inline int map_signal(int sig) ...@@ -455,7 +459,7 @@ static inline int map_signal(int sig)
static void setup_frame32(int sig, struct k_sigaction *ka, static void setup_frame32(int sig, struct k_sigaction *ka,
sigset_t *set, struct pt_regs * regs) sigset_t *set, struct pt_regs * regs)
{ {
sigframe32 *frame = get_sigframe(ka, regs, sizeof(sigframe32)); sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32));
if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32))) if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
goto give_sigsegv; goto give_sigsegv;
...@@ -474,12 +478,12 @@ static void setup_frame32(int sig, struct k_sigaction *ka, ...@@ -474,12 +478,12 @@ static void setup_frame32(int sig, struct k_sigaction *ka,
} else { } else {
regs->gprs[14] = (__u64) frame->retcode; regs->gprs[14] = (__u64) frame->retcode;
if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
(u16 *)(frame->retcode))) (u16 __user *)(frame->retcode)))
goto give_sigsegv; goto give_sigsegv;
} }
/* Set up backchain. */ /* Set up backchain. */
if (__put_user(regs->gprs[15], (unsigned int *) frame)) if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
...@@ -505,7 +509,7 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -505,7 +509,7 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs * regs) sigset_t *set, struct pt_regs * regs)
{ {
int err = 0; int err = 0;
rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32))) if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
goto give_sigsegv; goto give_sigsegv;
...@@ -531,11 +535,11 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -531,11 +535,11 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
} else { } else {
regs->gprs[14] = (__u64) frame->retcode; regs->gprs[14] = (__u64) frame->retcode;
err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
(u16 *)(frame->retcode)); (u16 __user *)(frame->retcode));
} }
/* Set up backchain. */ /* Set up backchain. */
if (__put_user(regs->gprs[15], (unsigned int *) frame)) if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
......
...@@ -62,9 +62,9 @@ extern void tod_to_timeval(uint64_t todval, struct timeval *xtime); ...@@ -62,9 +62,9 @@ extern void tod_to_timeval(uint64_t todval, struct timeval *xtime);
/* internal function prototyes */ /* internal function prototyes */
static int debug_init(void); static int debug_init(void);
static ssize_t debug_output(struct file *file, char *user_buf, static ssize_t debug_output(struct file *file, char __user *user_buf,
size_t user_len, loff_t * offset); size_t user_len, loff_t * offset);
static ssize_t debug_input(struct file *file, const char *user_buf, static ssize_t debug_input(struct file *file, const char __user *user_buf,
size_t user_len, loff_t * offset); size_t user_len, loff_t * offset);
static int debug_open(struct inode *inode, struct file *file); static int debug_open(struct inode *inode, struct file *file);
static int debug_close(struct inode *inode, struct file *file); static int debug_close(struct inode *inode, struct file *file);
...@@ -74,10 +74,10 @@ static void debug_info_put(debug_info_t *); ...@@ -74,10 +74,10 @@ static void debug_info_put(debug_info_t *);
static int debug_prolog_level_fn(debug_info_t * id, static int debug_prolog_level_fn(debug_info_t * id,
struct debug_view *view, char *out_buf); struct debug_view *view, char *out_buf);
static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
struct file *file, const char *user_buf, struct file *file, const char __user *user_buf,
size_t user_buf_size, loff_t * offset); size_t user_buf_size, loff_t * offset);
static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
struct file *file, const char *user_buf, struct file *file, const char __user *user_buf,
size_t user_buf_size, loff_t * offset); size_t user_buf_size, loff_t * offset);
static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view, static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
char *out_buf, const char *in_buf); char *out_buf, const char *in_buf);
...@@ -416,10 +416,10 @@ extern inline int debug_next_entry(file_private_info_t *p_info) ...@@ -416,10 +416,10 @@ extern inline int debug_next_entry(file_private_info_t *p_info)
* - copies formated debug entries to the user buffer * - copies formated debug entries to the user buffer
*/ */
static ssize_t debug_output(struct file *file, /* file descriptor */ static ssize_t debug_output(struct file *file, /* file descriptor */
char *user_buf, /* user buffer */ char __user *user_buf, /* user buffer */
size_t len, /* length of buffer */ size_t len, /* length of buffer */
loff_t *offset /* offset in the file */ ) loff_t *offset) /* offset in the file */
{ {
size_t count = 0; size_t count = 0;
size_t entry_offset, size = 0; size_t entry_offset, size = 0;
...@@ -462,7 +462,7 @@ static ssize_t debug_output(struct file *file, /* file descriptor */ ...@@ -462,7 +462,7 @@ static ssize_t debug_output(struct file *file, /* file descriptor */
*/ */
static ssize_t debug_input(struct file *file, static ssize_t debug_input(struct file *file,
const char *user_buf, size_t length, const char __user *user_buf, size_t length,
loff_t *offset) loff_t *offset)
{ {
int rc = 0; int rc = 0;
...@@ -942,7 +942,7 @@ static int debug_prolog_level_fn(debug_info_t * id, ...@@ -942,7 +942,7 @@ static int debug_prolog_level_fn(debug_info_t * id,
*/ */
static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
struct file *file, const char *user_buf, struct file *file, const char __user *user_buf,
size_t in_buf_size, loff_t * offset) size_t in_buf_size, loff_t * offset)
{ {
char input_buf[1]; char input_buf[1];
...@@ -1004,9 +1004,9 @@ void debug_flush(debug_info_t* id, int area) ...@@ -1004,9 +1004,9 @@ void debug_flush(debug_info_t* id, int area)
/* /*
* view function: flushes debug areas * view function: flushes debug areas
*/ */
static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
struct file *file, const char *user_buf, struct file *file, const char __user *user_buf,
size_t in_buf_size, loff_t * offset) size_t in_buf_size, loff_t * offset)
{ {
char input_buf[1]; char input_buf[1];
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/compiler.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -292,12 +293,12 @@ asmlinkage long sys_clone(struct pt_regs regs) ...@@ -292,12 +293,12 @@ asmlinkage long sys_clone(struct pt_regs regs)
{ {
unsigned long clone_flags; unsigned long clone_flags;
unsigned long newsp; unsigned long newsp;
int *parent_tidptr, *child_tidptr; int __user *parent_tidptr, *child_tidptr;
clone_flags = regs.gprs[3]; clone_flags = regs.gprs[3];
newsp = regs.orig_gpr2; newsp = regs.orig_gpr2;
parent_tidptr = (int *) regs.gprs[4]; parent_tidptr = (int __user *) regs.gprs[4];
child_tidptr = (int *) regs.gprs[5]; child_tidptr = (int __user *) regs.gprs[5];
if (!newsp) if (!newsp)
newsp = regs.gprs[15]; newsp = regs.gprs[15];
return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0, return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
...@@ -328,12 +329,12 @@ asmlinkage long sys_execve(struct pt_regs regs) ...@@ -328,12 +329,12 @@ asmlinkage long sys_execve(struct pt_regs regs)
int error; int error;
char * filename; char * filename;
filename = getname((char *) regs.orig_gpr2); filename = getname((char __user *) regs.orig_gpr2);
error = PTR_ERR(filename); error = PTR_ERR(filename);
if (IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
error = do_execve(filename, (char **) regs.gprs[3], error = do_execve(filename, (char __user * __user *) regs.gprs[3],
(char **) regs.gprs[4], &regs); (char __user * __user *) regs.gprs[4], &regs);
if (error == 0) { if (error == 0) {
current->ptrace &= ~PT_DTRACE; current->ptrace &= ~PT_DTRACE;
current->thread.fp_regs.fpc = 0; current->thread.fp_regs.fpc = 0;
......
...@@ -19,7 +19,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, ...@@ -19,7 +19,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
return len; return len;
} }
static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, static int prof_cpu_mask_write_proc (struct file *file,
const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
cpumask_t *mask = (cpumask_t *)data; cpumask_t *mask = (cpumask_t *)data;
......
...@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data) ...@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
} else } else
tmp = 0; tmp = 0;
return put_user(tmp, (addr_t *) data); return put_user(tmp, (addr_t __user *) data);
} }
/* /*
...@@ -269,7 +269,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) ...@@ -269,7 +269,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
if (copied != sizeof(tmp)) if (copied != sizeof(tmp))
return -EIO; return -EIO;
return put_user(tmp, (unsigned long *) data); return put_user(tmp, (unsigned long __user *) data);
case PTRACE_PEEKUSR: case PTRACE_PEEKUSR:
/* read the word at location addr in the USER area. */ /* read the word at location addr in the USER area. */
...@@ -291,7 +291,8 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) ...@@ -291,7 +291,8 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
case PTRACE_PEEKUSR_AREA: case PTRACE_PEEKUSR_AREA:
case PTRACE_POKEUSR_AREA: case PTRACE_POKEUSR_AREA:
if (copy_from_user(&parea, (void *) addr, sizeof(parea))) if (copy_from_user(&parea, (void __user *) addr,
sizeof(parea)))
return -EFAULT; return -EFAULT;
addr = parea.kernel_addr; addr = parea.kernel_addr;
data = parea.process_addr; data = parea.process_addr;
...@@ -301,7 +302,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) ...@@ -301,7 +302,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
ret = peek_user(child, addr, data); ret = peek_user(child, addr, data);
else { else {
addr_t tmp; addr_t tmp;
if (get_user (tmp, (addr_t *) data)) if (get_user (tmp, (addr_t __user *) data))
return -EFAULT; return -EFAULT;
ret = poke_user(child, addr, tmp); ret = poke_user(child, addr, tmp);
} }
...@@ -402,7 +403,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) ...@@ -402,7 +403,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
} else } else
tmp = 0; tmp = 0;
return put_user(tmp, (__u32 *) data); return put_user(tmp, (__u32 __user *) data);
} }
/* /*
...@@ -509,7 +510,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) ...@@ -509,7 +510,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
if (copied != sizeof(tmp)) if (copied != sizeof(tmp))
return -EIO; return -EIO;
return put_user(tmp, (unsigned int *) data); return put_user(tmp, (unsigned int __user *) data);
case PTRACE_PEEKUSR: case PTRACE_PEEKUSR:
/* read the word at location addr in the USER area. */ /* read the word at location addr in the USER area. */
...@@ -530,7 +531,8 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) ...@@ -530,7 +531,8 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
case PTRACE_PEEKUSR_AREA: case PTRACE_PEEKUSR_AREA:
case PTRACE_POKEUSR_AREA: case PTRACE_POKEUSR_AREA:
if (copy_from_user(&parea, (void *) addr, sizeof(parea))) if (copy_from_user(&parea, (void __user *) addr,
sizeof(parea)))
return -EFAULT; return -EFAULT;
addr = parea.kernel_addr; addr = parea.kernel_addr;
data = parea.process_addr; data = parea.process_addr;
...@@ -540,7 +542,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) ...@@ -540,7 +542,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
ret = peek_user_emu31(child, addr, data); ret = peek_user_emu31(child, addr, data);
else { else {
__u32 tmp; __u32 tmp;
if (get_user (tmp, (__u32 *) data)) if (get_user (tmp, (__u32 __user *) data))
return -EFAULT; return -EFAULT;
ret = poke_user_emu31(child, addr, tmp); ret = poke_user_emu31(child, addr, tmp);
} }
......
...@@ -77,8 +77,9 @@ sys_sigsuspend(struct pt_regs * regs, int history0, int history1, ...@@ -77,8 +77,9 @@ sys_sigsuspend(struct pt_regs * regs, int history0, int history1,
} }
} }
asmlinkage int asmlinkage long
sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset,
size_t sigsetsize)
{ {
sigset_t saveset, newset; sigset_t saveset, newset;
...@@ -105,9 +106,9 @@ sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) ...@@ -105,9 +106,9 @@ sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
} }
} }
asmlinkage int asmlinkage long
sys_sigaction(int sig, const struct old_sigaction *act, sys_sigaction(int sig, const struct old_sigaction __user *act,
struct old_sigaction *oact) struct old_sigaction __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -137,8 +138,9 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -137,8 +138,9 @@ sys_sigaction(int sig, const struct old_sigaction *act,
return ret; return ret;
} }
asmlinkage int asmlinkage long
sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
{ {
return do_sigaltstack(uss, uoss, regs->gprs[15]); return do_sigaltstack(uss, uoss, regs->gprs[15]);
} }
...@@ -146,7 +148,7 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) ...@@ -146,7 +148,7 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
/* Returns non-zero on fault. */ /* Returns non-zero on fault. */
static int save_sigregs(struct pt_regs *regs, _sigregs *sregs) static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
{ {
unsigned long old_mask = regs->psw.mask; unsigned long old_mask = regs->psw.mask;
int err; int err;
...@@ -175,7 +177,7 @@ static int save_sigregs(struct pt_regs *regs, _sigregs *sregs) ...@@ -175,7 +177,7 @@ static int save_sigregs(struct pt_regs *regs, _sigregs *sregs)
} }
/* Returns positive number on error */ /* Returns positive number on error */
static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs) static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
{ {
unsigned long old_mask = regs->psw.mask; unsigned long old_mask = regs->psw.mask;
int err; int err;
...@@ -208,7 +210,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs) ...@@ -208,7 +210,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
asmlinkage long sys_sigreturn(struct pt_regs *regs) asmlinkage long sys_sigreturn(struct pt_regs *regs)
{ {
sigframe *frame = (sigframe *)regs->gprs[15]; sigframe __user *frame = (sigframe __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
...@@ -234,7 +236,7 @@ asmlinkage long sys_sigreturn(struct pt_regs *regs) ...@@ -234,7 +236,7 @@ asmlinkage long sys_sigreturn(struct pt_regs *regs)
asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
{ {
rt_sigframe *frame = (rt_sigframe *)regs->gprs[15]; rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
...@@ -269,7 +271,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) ...@@ -269,7 +271,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
/* /*
* Determine which stack to use.. * Determine which stack to use..
*/ */
static inline void * static inline void __user *
get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
{ {
unsigned long sp; unsigned long sp;
...@@ -290,7 +292,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) ...@@ -290,7 +292,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
sp = (unsigned long) ka->sa.sa_restorer; sp = (unsigned long) ka->sa.sa_restorer;
} }
return (void *)((sp - frame_size) & -8ul); return (void __user *)((sp - frame_size) & -8ul);
} }
static inline int map_signal(int sig) static inline int map_signal(int sig)
...@@ -306,7 +308,9 @@ static inline int map_signal(int sig) ...@@ -306,7 +308,9 @@ static inline int map_signal(int sig)
static void setup_frame(int sig, struct k_sigaction *ka, static void setup_frame(int sig, struct k_sigaction *ka,
sigset_t *set, struct pt_regs * regs) sigset_t *set, struct pt_regs * regs)
{ {
sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe)); sigframe __user *frame;
frame = get_sigframe(ka, regs, sizeof(sigframe));
if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe))) if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe)))
goto give_sigsegv; goto give_sigsegv;
...@@ -326,13 +330,13 @@ static void setup_frame(int sig, struct k_sigaction *ka, ...@@ -326,13 +330,13 @@ static void setup_frame(int sig, struct k_sigaction *ka,
} else { } else {
regs->gprs[14] = (unsigned long) regs->gprs[14] = (unsigned long)
frame->retcode | PSW_ADDR_AMODE; frame->retcode | PSW_ADDR_AMODE;
if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
(u16 *)(frame->retcode))) (u16 __user *)(frame->retcode)))
goto give_sigsegv; goto give_sigsegv;
} }
/* Set up backchain. */ /* Set up backchain. */
if (__put_user(regs->gprs[15], (addr_t *) frame)) if (__put_user(regs->gprs[15], (addr_t __user *) frame))
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
...@@ -358,7 +362,9 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -358,7 +362,9 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs * regs) sigset_t *set, struct pt_regs * regs)
{ {
int err = 0; int err = 0;
rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); rt_sigframe __user *frame;
frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe))) if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe)))
goto give_sigsegv; goto give_sigsegv;
...@@ -385,12 +391,12 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -385,12 +391,12 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} else { } else {
regs->gprs[14] = (unsigned long) regs->gprs[14] = (unsigned long)
frame->retcode | PSW_ADDR_AMODE; frame->retcode | PSW_ADDR_AMODE;
err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
(u16 *)(frame->retcode)); (u16 __user *)(frame->retcode));
} }
/* Set up backchain. */ /* Set up backchain. */
if (__put_user(regs->gprs[15], (addr_t *) frame)) if (__put_user(regs->gprs[15], (addr_t __user *) frame))
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* sys_pipe() is the normal C calling standard for creating * sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way Unix traditionally does this, though. * a pipe. It's not the way Unix traditionally does this, though.
*/ */
asmlinkage long sys_pipe(unsigned long * fildes) asmlinkage long sys_pipe(unsigned long __user *fildes)
{ {
int fd[2]; int fd[2];
int error; int error;
...@@ -92,7 +92,7 @@ struct mmap_arg_struct { ...@@ -92,7 +92,7 @@ struct mmap_arg_struct {
unsigned long offset; unsigned long offset;
}; };
asmlinkage long sys_mmap2(struct mmap_arg_struct *arg) asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg)
{ {
struct mmap_arg_struct a; struct mmap_arg_struct a;
int error = -EFAULT; int error = -EFAULT;
...@@ -104,7 +104,7 @@ asmlinkage long sys_mmap2(struct mmap_arg_struct *arg) ...@@ -104,7 +104,7 @@ asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
return error; return error;
} }
asmlinkage long old_mmap(struct mmap_arg_struct *arg) asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
{ {
struct mmap_arg_struct a; struct mmap_arg_struct a;
long error = -EFAULT; long error = -EFAULT;
...@@ -128,7 +128,7 @@ struct sel_arg_struct { ...@@ -128,7 +128,7 @@ struct sel_arg_struct {
struct timeval *tvp; struct timeval *tvp;
}; };
asmlinkage long old_select(struct sel_arg_struct *arg) asmlinkage long old_select(struct sel_arg_struct __user *arg)
{ {
struct sel_arg_struct a; struct sel_arg_struct a;
...@@ -145,37 +145,37 @@ asmlinkage long old_select(struct sel_arg_struct *arg) ...@@ -145,37 +145,37 @@ asmlinkage long old_select(struct sel_arg_struct *arg)
* *
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage long sys_ipc (uint call, int first, int second, asmlinkage long sys_ipc(uint call, int first, int second,
unsigned long third, void *ptr) unsigned long third, void __user *ptr)
{ {
struct ipc_kludge tmp; struct ipc_kludge tmp;
int ret; int ret;
switch (call) { switch (call) {
case SEMOP: case SEMOP:
return sys_semtimedop (first, (struct sembuf *) ptr, second, return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
NULL); NULL);
case SEMTIMEDOP: case SEMTIMEDOP:
return sys_semtimedop (first, (struct sembuf *) ptr, second, return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
(const struct timespec *) third); (const struct timespec __user *) third);
case SEMGET: case SEMGET:
return sys_semget (first, second, third); return sys_semget (first, second, third);
case SEMCTL: { case SEMCTL: {
union semun fourth; union semun fourth;
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (get_user(fourth.__pad, (void **) ptr)) if (get_user(fourth.__pad, (void __user * __user *) ptr))
return -EFAULT; return -EFAULT;
return sys_semctl (first, second, third, fourth); return sys_semctl (first, second, third, fourth);
} }
case MSGSND: case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr, return sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third); second, third);
break; break;
case MSGRCV: case MSGRCV:
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (copy_from_user (&tmp, (struct ipc_kludge *) ptr, if (copy_from_user (&tmp, (struct ipc_kludge __user *) ptr,
sizeof (struct ipc_kludge))) sizeof (struct ipc_kludge)))
return -EFAULT; return -EFAULT;
return sys_msgrcv (first, tmp.msgp, return sys_msgrcv (first, tmp.msgp,
...@@ -183,33 +183,33 @@ asmlinkage long sys_ipc (uint call, int first, int second, ...@@ -183,33 +183,33 @@ asmlinkage long sys_ipc (uint call, int first, int second,
case MSGGET: case MSGGET:
return sys_msgget ((key_t) first, second); return sys_msgget ((key_t) first, second);
case MSGCTL: case MSGCTL:
return sys_msgctl (first, second, (struct msqid_ds *) ptr); return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
case SHMAT: { case SHMAT: {
ulong raddr; ulong raddr;
ret = do_shmat (first, (char *) ptr, second, &raddr); ret = do_shmat (first, (char __user *) ptr, second, &raddr);
if (ret) if (ret)
return ret; return ret;
return put_user (raddr, (ulong *) third); return put_user (raddr, (ulong __user *) third);
break; break;
} }
case SHMDT: case SHMDT:
return sys_shmdt ((char *)ptr); return sys_shmdt ((char __user *)ptr);
case SHMGET: case SHMGET:
return sys_shmget (first, second, third); return sys_shmget (first, second, third);
case SHMCTL: case SHMCTL:
return sys_shmctl (first, second, return sys_shmctl (first, second,
(struct shmid_ds *) ptr); (struct shmid_ds __user *) ptr);
default: default:
return -ENOSYS; return -ENOSYS;
} }
return -EINVAL; return -EINVAL;
} }
#ifdef CONFIG_ARCH_S390X #ifdef CONFIG_ARCH_S390X
asmlinkage long s390x_newuname(struct new_utsname * name) asmlinkage long s390x_newuname(struct new_utsname __user *name)
{ {
int ret = sys_newuname(name); int ret = sys_newuname(name);
...@@ -256,7 +256,7 @@ struct fadvise64_64_args { ...@@ -256,7 +256,7 @@ struct fadvise64_64_args {
}; };
asmlinkage long asmlinkage long
s390_fadvise64_64(struct fadvise64_64_args *args) s390_fadvise64_64(struct fadvise64_64_args __user *args)
{ {
struct fadvise64_64_args a; struct fadvise64_64_args a;
......
...@@ -188,7 +188,7 @@ void show_registers(struct pt_regs *regs) ...@@ -188,7 +188,7 @@ void show_registers(struct pt_regs *regs)
printk("%s Code: ", mode); printk("%s Code: ", mode);
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {
unsigned char c; unsigned char c;
if (__get_user(c, (char *)(regs->psw.addr + i))) { if (__get_user(c, (char __user *)(regs->psw.addr + i))) {
printk(" Bad PSW."); printk(" Bad PSW.");
break; break;
} }
...@@ -391,7 +391,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code) ...@@ -391,7 +391,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
local_irq_enable(); local_irq_enable();
if (regs->psw.mask & PSW_MASK_PSTATE) if (regs->psw.mask & PSW_MASK_PSTATE)
get_user(*((__u16 *) opcode), location); get_user(*((__u16 *) opcode), (__u16 __user *)location);
else else
*((__u16 *)opcode)=*((__u16 *)location); *((__u16 *)opcode)=*((__u16 *)location);
if (*((__u16 *)opcode)==S390_BREAKPOINT_U16) if (*((__u16 *)opcode)==S390_BREAKPOINT_U16)
......
...@@ -134,5 +134,5 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag ...@@ -134,5 +134,5 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
void iounmap(void *addr) void iounmap(void *addr)
{ {
if (addr > high_memory) if (addr > high_memory)
return vfree(addr); vfree(addr);
} }
...@@ -93,8 +93,8 @@ csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) ...@@ -93,8 +93,8 @@ csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
static inline unsigned int static inline unsigned int
csum_partial_copy_from_user (const char *src, char *dst, csum_partial_copy_from_user(const char __user *src, char *dst,
int len, unsigned int sum, int len, unsigned int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -123,19 +123,19 @@ typedef u32 compat_sigset_word; ...@@ -123,19 +123,19 @@ typedef u32 compat_sigset_word;
*/ */
typedef u32 compat_uptr_t; typedef u32 compat_uptr_t;
static inline void *compat_ptr(compat_uptr_t uptr) static inline void __user *compat_ptr(compat_uptr_t uptr)
{ {
return (void *)(unsigned long)(uptr & 0x7fffffffUL); return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
} }
static inline void *compat_alloc_user_space(long len) static inline void __user *compat_alloc_user_space(long len)
{ {
unsigned long stack; unsigned long stack;
stack = KSTK_ESP(current); stack = KSTK_ESP(current);
if (test_thread_flag(TIF_31BIT)) if (test_thread_flag(TIF_31BIT))
stack &= 0x7fffffffUL; stack &= 0x7fffffffUL;
return (void *) (stack - len); return (void __user *) (stack - len);
} }
struct compat_ipc64_perm { struct compat_ipc64_perm {
......
...@@ -91,7 +91,8 @@ typedef int (debug_prolog_proc_t) (debug_info_t* id, ...@@ -91,7 +91,8 @@ typedef int (debug_prolog_proc_t) (debug_info_t* id,
char* out_buf); char* out_buf);
typedef int (debug_input_proc_t) (debug_info_t* id, typedef int (debug_input_proc_t) (debug_info_t* id,
struct debug_view* view, struct debug_view* view,
struct file* file, const char* user_buf, struct file* file,
const char __user *user_buf,
size_t in_buf_size, loff_t* offset); size_t in_buf_size, loff_t* offset);
int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view, int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
...@@ -234,26 +235,6 @@ int debug_unregister_view(debug_info_t* id, struct debug_view* view); ...@@ -234,26 +235,6 @@ int debug_unregister_view(debug_info_t* id, struct debug_view* view);
#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) #define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
#endif /* DASD_DEBUG */ #endif /* DASD_DEBUG */
#if DASD_DEBUG > 4
#define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) )
#elif DASD_DEBUG > 2
#define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) )
#elif DASD_DEBUG > 0
#define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) )
#else
#define INTERNAL_ERROR(x...)
#endif /* DASD_DEBUG */
#if DASD_DEBUG > 5
#define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) )
#elif DASD_DEBUG > 3
#define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) )
#elif DASD_DEBUG > 1
#define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) )
#else
#define INTERNAL_CHECK(x...)
#endif /* DASD_DEBUG */
#undef DEBUG_MALLOC #undef DEBUG_MALLOC
#ifdef DEBUG_MALLOC #ifdef DEBUG_MALLOC
void *b; void *b;
......
...@@ -218,7 +218,7 @@ idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw) ...@@ -218,7 +218,7 @@ idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw)
* Copy count bytes from an idal buffer to user memory * Copy count bytes from an idal buffer to user memory
*/ */
static inline size_t static inline size_t
idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count) idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
{ {
size_t left; size_t left;
int i; int i;
...@@ -228,7 +228,7 @@ idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count) ...@@ -228,7 +228,7 @@ idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count)
left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE); left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
if (left) if (left)
return left + count - IDA_BLOCK_SIZE; return left + count - IDA_BLOCK_SIZE;
to = (void *) to + IDA_BLOCK_SIZE; to = (void __user *) to + IDA_BLOCK_SIZE;
count -= IDA_BLOCK_SIZE; count -= IDA_BLOCK_SIZE;
} }
return copy_to_user(to, ib->data[i], count); return copy_to_user(to, ib->data[i], count);
...@@ -238,7 +238,7 @@ idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count) ...@@ -238,7 +238,7 @@ idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count)
* Copy count bytes from user memory to an idal buffer * Copy count bytes from user memory to an idal buffer
*/ */
static inline size_t static inline size_t
idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count) idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
{ {
size_t left; size_t left;
int i; int i;
...@@ -248,7 +248,7 @@ idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count) ...@@ -248,7 +248,7 @@ idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count)
left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE); left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
if (left) if (left)
return left + count - IDA_BLOCK_SIZE; return left + count - IDA_BLOCK_SIZE;
from = (void *) from + IDA_BLOCK_SIZE; from = (void __user *) from + IDA_BLOCK_SIZE;
count -= IDA_BLOCK_SIZE; count -= IDA_BLOCK_SIZE;
} }
return copy_from_user(ib->data[i], from, count); return copy_from_user(ib->data[i], from, count);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* See arch/s390/kernel/sys_s390.c for ugly details.. * See arch/s390/kernel/sys_s390.c for ugly details..
*/ */
struct ipc_kludge { struct ipc_kludge {
struct msgbuf *msgp; struct msgbuf __user *msgp;
long msgtyp; long msgtyp;
}; };
......
...@@ -48,7 +48,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp) ...@@ -48,7 +48,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp)
{ {
#ifndef __s390x__ #ifndef __s390x__
unsigned int reg1, reg2; unsigned int reg1, reg2;
__asm__ __volatile(" bras %0,1f\n" __asm__ __volatile__(" bras %0,1f\n"
"0: diag 0,0,68\n" "0: diag 0,0,68\n"
"1: slr %1,%1\n" "1: slr %1,%1\n"
" cs %1,%0,0(%3)\n" " cs %1,%0,0(%3)\n"
...@@ -58,7 +58,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp) ...@@ -58,7 +58,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp)
: "cc", "memory" ); : "cc", "memory" );
#else /* __s390x__ */ #else /* __s390x__ */
unsigned long reg1, reg2; unsigned long reg1, reg2;
__asm__ __volatile(" bras %1,1f\n" __asm__ __volatile__(" bras %1,1f\n"
"0: " __DIAG44_INSN " 0,%4\n" "0: " __DIAG44_INSN " 0,%4\n"
"1: slr %0,%0\n" "1: slr %0,%0\n"
" cs %0,%1,0(%3)\n" " cs %0,%1,0(%3)\n"
...@@ -74,7 +74,7 @@ extern inline int _raw_spin_trylock(spinlock_t *lp) ...@@ -74,7 +74,7 @@ extern inline int _raw_spin_trylock(spinlock_t *lp)
unsigned long reg; unsigned long reg;
unsigned int result; unsigned int result;
__asm__ __volatile(" basr %1,0\n" __asm__ __volatile__(" basr %1,0\n"
"0: cs %0,%1,0(%3)" "0: cs %0,%1,0(%3)"
: "=d" (result), "=&d" (reg), "=m" (lp->lock) : "=d" (result), "=&d" (reg), "=m" (lp->lock)
: "a" (&lp->lock), "m" (lp->lock), "0" (0) : "a" (&lp->lock), "m" (lp->lock), "0" (0)
...@@ -86,7 +86,7 @@ extern inline void _raw_spin_unlock(spinlock_t *lp) ...@@ -86,7 +86,7 @@ extern inline void _raw_spin_unlock(spinlock_t *lp)
{ {
unsigned int old; unsigned int old;
__asm__ __volatile("cs %0,%3,0(%4)" __asm__ __volatile__("cs %0,%3,0(%4)"
: "=d" (old), "=m" (lp->lock) : "=d" (old), "=m" (lp->lock)
: "0" (lp->lock), "d" (0), "a" (lp) : "0" (lp->lock), "d" (0), "a" (lp)
: "cc", "memory" ); : "cc", "memory" );
......
...@@ -65,9 +65,10 @@ ...@@ -65,9 +65,10 @@
#define access_ok(type,addr,size) __access_ok(addr,size) #define access_ok(type,addr,size) __access_ok(addr,size)
extern inline int verify_area(int type, const void * addr, unsigned long size) extern inline int verify_area(int type, const void __user *addr,
unsigned long size)
{ {
return access_ok(type,addr,size)?0:-EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
} }
/* /*
...@@ -147,6 +148,7 @@ struct exception_table_entry ...@@ -147,6 +148,7 @@ struct exception_table_entry
}) })
#endif #endif
#ifndef __CHECKER__
#define __put_user(x, ptr) \ #define __put_user(x, ptr) \
({ \ ({ \
__typeof__(*(ptr)) __x = (x); \ __typeof__(*(ptr)) __x = (x); \
...@@ -164,6 +166,14 @@ struct exception_table_entry ...@@ -164,6 +166,14 @@ struct exception_table_entry
} \ } \
__pu_err; \ __pu_err; \
}) })
#else
#define __put_user(x, ptr) \
({ \
void __user *p; \
p = (ptr); \
0; \
})
#endif
#define put_user(x, ptr) \ #define put_user(x, ptr) \
({ \ ({ \
...@@ -202,6 +212,7 @@ extern int __put_user_bad(void); ...@@ -202,6 +212,7 @@ extern int __put_user_bad(void);
}) })
#endif #endif
#ifndef __CHECKER__
#define __get_user(x, ptr) \ #define __get_user(x, ptr) \
({ \ ({ \
__typeof__(*(ptr)) __x; \ __typeof__(*(ptr)) __x; \
...@@ -221,6 +232,15 @@ extern int __put_user_bad(void); ...@@ -221,6 +232,15 @@ extern int __put_user_bad(void);
(x) = __x; \ (x) = __x; \
__gu_err; \ __gu_err; \
}) })
#else
#define __get_user(x, ptr) \
({ \
void __user *p; \
p = (ptr); \
0; \
})
#endif
#define get_user(x, ptr) \ #define get_user(x, ptr) \
({ \ ({ \
...@@ -230,7 +250,7 @@ extern int __put_user_bad(void); ...@@ -230,7 +250,7 @@ extern int __put_user_bad(void);
extern int __get_user_bad(void); extern int __get_user_bad(void);
extern long __copy_to_user_asm(const void *from, long n, void *to); extern long __copy_to_user_asm(const void *from, long n, void __user *to);
/** /**
* __copy_to_user: - Copy a block of data into user space, with less checking. * __copy_to_user: - Copy a block of data into user space, with less checking.
...@@ -274,7 +294,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n) ...@@ -274,7 +294,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
return n; return n;
} }
extern long __copy_from_user_asm(void *to, long n, const void *from); extern long __copy_from_user_asm(void *to, long n, const void __user *from);
/** /**
* __copy_from_user: - Copy a block of data from user space, with less checking. * __copy_from_user: - Copy a block of data from user space, with less checking.
...@@ -326,7 +346,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n) ...@@ -326,7 +346,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
return n; return n;
} }
extern unsigned long __copy_in_user_asm(const void *from, long n, void *to); extern unsigned long __copy_in_user_asm(const void __user *from, long n,
void __user *to);
static inline unsigned long static inline unsigned long
__copy_in_user(void __user *to, const void __user *from, unsigned long n) __copy_in_user(void __user *to, const void __user *from, unsigned long n)
...@@ -346,10 +367,11 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n) ...@@ -346,10 +367,11 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
/* /*
* Copy a null terminated string from userspace. * Copy a null terminated string from userspace.
*/ */
extern long __strncpy_from_user_asm(char *dst, const char *src, long count); extern long __strncpy_from_user_asm(char *dst, const char __user *src,
long count);
static inline long static inline long
strncpy_from_user(char *dst, const char *src, long count) strncpy_from_user(char *dst, const char __user *src, long count)
{ {
long res = -EFAULT; long res = -EFAULT;
might_sleep(); might_sleep();
...@@ -359,10 +381,10 @@ strncpy_from_user(char *dst, const char *src, long count) ...@@ -359,10 +381,10 @@ strncpy_from_user(char *dst, const char *src, long count)
} }
extern long __strnlen_user_asm(const char *src, long count); extern long __strnlen_user_asm(const char __user *src, long count);
static inline unsigned long static inline unsigned long
strnlen_user(const char * src, unsigned long n) strnlen_user(const char __user * src, unsigned long n)
{ {
might_sleep(); might_sleep();
return __strnlen_user_asm(src, n); return __strnlen_user_asm(src, n);
...@@ -388,16 +410,16 @@ strnlen_user(const char * src, unsigned long n) ...@@ -388,16 +410,16 @@ strnlen_user(const char * src, unsigned long n)
* Zero Userspace * Zero Userspace
*/ */
extern long __clear_user_asm(void *to, long n); extern long __clear_user_asm(void __user *to, long n);
static inline unsigned long static inline unsigned long
__clear_user(void *to, unsigned long n) __clear_user(void __user *to, unsigned long n)
{ {
return __clear_user_asm(to, n); return __clear_user_asm(to, n);
} }
static inline unsigned long static inline unsigned long
clear_user(void *to, unsigned long n) clear_user(void __user *to, unsigned long n)
{ {
might_sleep(); might_sleep();
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment