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
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;
......@@ -130,7 +130,8 @@ sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t
}
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;
compat_sigset_t set32;
......@@ -165,8 +166,8 @@ sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigse
}
asmlinkage long
sys32_sigaction(int sig, const struct old_sigaction32 *act,
struct old_sigaction32 *oact)
sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -200,8 +201,8 @@ int
do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
asmlinkage long
sys32_rt_sigaction(int sig, const struct sigaction32 *act,
struct sigaction32 *oact, size_t sigsetsize)
sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
struct sigaction32 __user *oact, size_t sigsetsize)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -258,7 +259,8 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act,
}
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;
int ret, err = 0;
......@@ -275,7 +277,9 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
}
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);
if (!ret && uoss) {
......@@ -290,7 +294,7 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
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;
int err, i;
......@@ -311,7 +315,7 @@ static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
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;
int err, i;
......@@ -343,7 +347,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
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;
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
......@@ -369,7 +373,7 @@ asmlinkage long sys32_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;
stack_t st;
__u32 ss_sp;
......@@ -400,7 +404,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
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);
return regs->gprs[2];
......@@ -418,7 +422,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
/*
* 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)
{
unsigned long sp;
......@@ -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;
}
return (void *)((sp - frame_size) & -8ul);
return (void __user *)((sp - frame_size) & -8ul);
}
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,
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)))
goto give_sigsegv;
......@@ -474,12 +478,12 @@ static void setup_frame32(int sig, struct k_sigaction *ka,
} else {
regs->gprs[14] = (__u64) frame->retcode;
if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
(u16 *)(frame->retcode)))
(u16 __user *)(frame->retcode)))
goto give_sigsegv;
}
/* 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;
/* Set up registers for signal handler */
......@@ -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)
{
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)))
goto give_sigsegv;
......@@ -531,11 +535,11 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
} else {
regs->gprs[14] = (__u64) frame->retcode;
err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
(u16 *)(frame->retcode));
(u16 __user *)(frame->retcode));
}
/* 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;
/* Set up registers for signal handler */
......
......@@ -62,9 +62,9 @@ extern void tod_to_timeval(uint64_t todval, struct timeval *xtime);
/* internal function prototyes */
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);
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);
static int debug_open(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 *);
static int debug_prolog_level_fn(debug_info_t * id,
struct debug_view *view, char *out_buf);
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);
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);
static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
char *out_buf, const char *in_buf);
......@@ -417,9 +417,9 @@ extern inline int debug_next_entry(file_private_info_t *p_info)
*/
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 */
loff_t *offset /* offset in the file */ )
loff_t *offset) /* offset in the file */
{
size_t count = 0;
size_t entry_offset, size = 0;
......@@ -462,7 +462,7 @@ static ssize_t debug_output(struct file *file, /* file descriptor */
*/
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)
{
int rc = 0;
......@@ -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,
struct file *file, const char *user_buf,
struct file *file, const char __user *user_buf,
size_t in_buf_size, loff_t * offset)
{
char input_buf[1];
......@@ -1006,7 +1006,7 @@ void debug_flush(debug_info_t* id, int area)
*/
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)
{
char input_buf[1];
......
......@@ -16,6 +16,7 @@
*/
#include <linux/config.h>
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
......@@ -292,12 +293,12 @@ asmlinkage long sys_clone(struct pt_regs regs)
{
unsigned long clone_flags;
unsigned long newsp;
int *parent_tidptr, *child_tidptr;
int __user *parent_tidptr, *child_tidptr;
clone_flags = regs.gprs[3];
newsp = regs.orig_gpr2;
parent_tidptr = (int *) regs.gprs[4];
child_tidptr = (int *) regs.gprs[5];
parent_tidptr = (int __user *) regs.gprs[4];
child_tidptr = (int __user *) regs.gprs[5];
if (!newsp)
newsp = regs.gprs[15];
return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
......@@ -328,12 +329,12 @@ asmlinkage long sys_execve(struct pt_regs regs)
int error;
char * filename;
filename = getname((char *) regs.orig_gpr2);
filename = getname((char __user *) regs.orig_gpr2);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, (char **) regs.gprs[3],
(char **) regs.gprs[4], &regs);
error = do_execve(filename, (char __user * __user *) regs.gprs[3],
(char __user * __user *) regs.gprs[4], &regs);
if (error == 0) {
current->ptrace &= ~PT_DTRACE;
current->thread.fp_regs.fpc = 0;
......
......@@ -19,7 +19,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
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)
{
cpumask_t *mask = (cpumask_t *)data;
......
......@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
} else
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)
copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
if (copied != sizeof(tmp))
return -EIO;
return put_user(tmp, (unsigned long *) data);
return put_user(tmp, (unsigned long __user *) data);
case PTRACE_PEEKUSR:
/* 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)
case PTRACE_PEEKUSR_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;
addr = parea.kernel_addr;
data = parea.process_addr;
......@@ -301,7 +302,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
ret = peek_user(child, addr, data);
else {
addr_t tmp;
if (get_user (tmp, (addr_t *) data))
if (get_user (tmp, (addr_t __user *) data))
return -EFAULT;
ret = poke_user(child, addr, tmp);
}
......@@ -402,7 +403,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
} else
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)
copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
if (copied != sizeof(tmp))
return -EIO;
return put_user(tmp, (unsigned int *) data);
return put_user(tmp, (unsigned int __user *) data);
case PTRACE_PEEKUSR:
/* 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)
case PTRACE_PEEKUSR_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;
addr = parea.kernel_addr;
data = parea.process_addr;
......@@ -540,7 +542,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
ret = peek_user_emu31(child, addr, data);
else {
__u32 tmp;
if (get_user (tmp, (__u32 *) data))
if (get_user (tmp, (__u32 __user *) data))
return -EFAULT;
ret = poke_user_emu31(child, addr, tmp);
}
......
......@@ -77,8 +77,9 @@ sys_sigsuspend(struct pt_regs * regs, int history0, int history1,
}
}
asmlinkage int
sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
asmlinkage long
sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset,
size_t sigsetsize)
{
sigset_t saveset, newset;
......@@ -105,9 +106,9 @@ sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
}
}
asmlinkage int
sys_sigaction(int sig, const struct old_sigaction *act,
struct old_sigaction *oact)
asmlinkage long
sys_sigaction(int sig, const struct old_sigaction __user *act,
struct old_sigaction __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -137,8 +138,9 @@ sys_sigaction(int sig, const struct old_sigaction *act,
return ret;
}
asmlinkage int
sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
asmlinkage long
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
{
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)
/* 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;
int err;
......@@ -175,7 +177,7 @@ static int save_sigregs(struct pt_regs *regs, _sigregs *sregs)
}
/* 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;
int err;
......@@ -208,7 +210,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
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;
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
......@@ -234,7 +236,7 @@ asmlinkage long sys_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;
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
......@@ -269,7 +271,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
/*
* 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)
{
unsigned long sp;
......@@ -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;
}
return (void *)((sp - frame_size) & -8ul);
return (void __user *)((sp - frame_size) & -8ul);
}
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,
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)))
goto give_sigsegv;
......@@ -327,12 +331,12 @@ static void setup_frame(int sig, struct k_sigaction *ka,
regs->gprs[14] = (unsigned long)
frame->retcode | PSW_ADDR_AMODE;
if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
(u16 *)(frame->retcode)))
(u16 __user *)(frame->retcode)))
goto give_sigsegv;
}
/* 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;
/* Set up registers for signal handler */
......@@ -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)
{
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)))
goto give_sigsegv;
......@@ -386,11 +392,11 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
regs->gprs[14] = (unsigned long)
frame->retcode | PSW_ADDR_AMODE;
err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
(u16 *)(frame->retcode));
(u16 __user *)(frame->retcode));
}
/* 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;
/* Set up registers for signal handler */
......
......@@ -37,7 +37,7 @@
* sys_pipe() is the normal C calling standard for creating
* 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 error;
......@@ -92,7 +92,7 @@ struct mmap_arg_struct {
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;
int error = -EFAULT;
......@@ -104,7 +104,7 @@ asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
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;
long error = -EFAULT;
......@@ -128,7 +128,7 @@ struct sel_arg_struct {
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;
......@@ -145,37 +145,37 @@ asmlinkage long old_select(struct sel_arg_struct *arg)
*
* This is really horribly ugly.
*/
asmlinkage long sys_ipc (uint call, int first, int second,
unsigned long third, void *ptr)
asmlinkage long sys_ipc(uint call, int first, int second,
unsigned long third, void __user *ptr)
{
struct ipc_kludge tmp;
int ret;
switch (call) {
case SEMOP:
return sys_semtimedop (first, (struct sembuf *) ptr, second,
return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
NULL);
case SEMTIMEDOP:
return sys_semtimedop (first, (struct sembuf *) ptr, second,
(const struct timespec *) third);
return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
(const struct timespec __user *) third);
case SEMGET:
return sys_semget (first, second, third);
case SEMCTL: {
union semun fourth;
if (!ptr)
return -EINVAL;
if (get_user(fourth.__pad, (void **) ptr))
if (get_user(fourth.__pad, (void __user * __user *) ptr))
return -EFAULT;
return sys_semctl (first, second, third, fourth);
}
case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr,
return sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third);
break;
case MSGRCV:
if (!ptr)
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)))
return -EFAULT;
return sys_msgrcv (first, tmp.msgp,
......@@ -183,23 +183,23 @@ asmlinkage long sys_ipc (uint call, int first, int second,
case MSGGET:
return sys_msgget ((key_t) first, second);
case MSGCTL:
return sys_msgctl (first, second, (struct msqid_ds *) ptr);
return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
case SHMAT: {
ulong raddr;
ret = do_shmat (first, (char *) ptr, second, &raddr);
ret = do_shmat (first, (char __user *) ptr, second, &raddr);
if (ret)
return ret;
return put_user (raddr, (ulong *) third);
return put_user (raddr, (ulong __user *) third);
break;
}
case SHMDT:
return sys_shmdt ((char *)ptr);
return sys_shmdt ((char __user *)ptr);
case SHMGET:
return sys_shmget (first, second, third);
case SHMCTL:
return sys_shmctl (first, second,
(struct shmid_ds *) ptr);
(struct shmid_ds __user *) ptr);
default:
return -ENOSYS;
......@@ -209,7 +209,7 @@ asmlinkage long sys_ipc (uint call, int first, int second,
}
#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);
......@@ -256,7 +256,7 @@ struct fadvise64_64_args {
};
asmlinkage long
s390_fadvise64_64(struct fadvise64_64_args *args)
s390_fadvise64_64(struct fadvise64_64_args __user *args)
{
struct fadvise64_64_args a;
......
......@@ -188,7 +188,7 @@ void show_registers(struct pt_regs *regs)
printk("%s Code: ", mode);
for (i = 0; i < 20; i++) {
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.");
break;
}
......@@ -391,7 +391,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
local_irq_enable();
if (regs->psw.mask & PSW_MASK_PSTATE)
get_user(*((__u16 *) opcode), location);
get_user(*((__u16 *) opcode), (__u16 __user *)location);
else
*((__u16 *)opcode)=*((__u16 *)location);
if (*((__u16 *)opcode)==S390_BREAKPOINT_U16)
......
......@@ -134,5 +134,5 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
void iounmap(void *addr)
{
if (addr > high_memory)
return vfree(addr);
vfree(addr);
}
......@@ -94,7 +94,7 @@ csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
* then zero the rest of the buffer.
*/
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 *err_ptr)
{
......
......@@ -123,19 +123,19 @@ typedef u32 compat_sigset_word;
*/
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;
stack = KSTK_ESP(current);
if (test_thread_flag(TIF_31BIT))
stack &= 0x7fffffffUL;
return (void *) (stack - len);
return (void __user *) (stack - len);
}
struct compat_ipc64_perm {
......
......@@ -91,7 +91,8 @@ typedef int (debug_prolog_proc_t) (debug_info_t* id,
char* out_buf);
typedef int (debug_input_proc_t) (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);
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);
#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
#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
#ifdef DEBUG_MALLOC
void *b;
......
......@@ -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
*/
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;
int i;
......@@ -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);
if (left)
return left + count - IDA_BLOCK_SIZE;
to = (void *) to + IDA_BLOCK_SIZE;
to = (void __user *) to + IDA_BLOCK_SIZE;
count -= IDA_BLOCK_SIZE;
}
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)
* Copy count bytes from user memory to an idal buffer
*/
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;
int i;
......@@ -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);
if (left)
return left + count - IDA_BLOCK_SIZE;
from = (void *) from + IDA_BLOCK_SIZE;
from = (void __user *) from + IDA_BLOCK_SIZE;
count -= IDA_BLOCK_SIZE;
}
return copy_from_user(ib->data[i], from, count);
......
......@@ -15,7 +15,7 @@
* See arch/s390/kernel/sys_s390.c for ugly details..
*/
struct ipc_kludge {
struct msgbuf *msgp;
struct msgbuf __user *msgp;
long msgtyp;
};
......
......@@ -48,7 +48,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp)
{
#ifndef __s390x__
unsigned int reg1, reg2;
__asm__ __volatile(" bras %0,1f\n"
__asm__ __volatile__(" bras %0,1f\n"
"0: diag 0,0,68\n"
"1: slr %1,%1\n"
" cs %1,%0,0(%3)\n"
......@@ -58,7 +58,7 @@ extern inline void _raw_spin_lock(spinlock_t *lp)
: "cc", "memory" );
#else /* __s390x__ */
unsigned long reg1, reg2;
__asm__ __volatile(" bras %1,1f\n"
__asm__ __volatile__(" bras %1,1f\n"
"0: " __DIAG44_INSN " 0,%4\n"
"1: slr %0,%0\n"
" cs %0,%1,0(%3)\n"
......@@ -74,7 +74,7 @@ extern inline int _raw_spin_trylock(spinlock_t *lp)
unsigned long reg;
unsigned int result;
__asm__ __volatile(" basr %1,0\n"
__asm__ __volatile__(" basr %1,0\n"
"0: cs %0,%1,0(%3)"
: "=d" (result), "=&d" (reg), "=m" (lp->lock)
: "a" (&lp->lock), "m" (lp->lock), "0" (0)
......@@ -86,7 +86,7 @@ extern inline void _raw_spin_unlock(spinlock_t *lp)
{
unsigned int old;
__asm__ __volatile("cs %0,%3,0(%4)"
__asm__ __volatile__("cs %0,%3,0(%4)"
: "=d" (old), "=m" (lp->lock)
: "0" (lp->lock), "d" (0), "a" (lp)
: "cc", "memory" );
......
......@@ -65,9 +65,10 @@
#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
})
#endif
#ifndef __CHECKER__
#define __put_user(x, ptr) \
({ \
__typeof__(*(ptr)) __x = (x); \
......@@ -164,6 +166,14 @@ struct exception_table_entry
} \
__pu_err; \
})
#else
#define __put_user(x, ptr) \
({ \
void __user *p; \
p = (ptr); \
0; \
})
#endif
#define put_user(x, ptr) \
({ \
......@@ -202,6 +212,7 @@ extern int __put_user_bad(void);
})
#endif
#ifndef __CHECKER__
#define __get_user(x, ptr) \
({ \
__typeof__(*(ptr)) __x; \
......@@ -221,6 +232,15 @@ extern int __put_user_bad(void);
(x) = __x; \
__gu_err; \
})
#else
#define __get_user(x, ptr) \
({ \
void __user *p; \
p = (ptr); \
0; \
})
#endif
#define get_user(x, ptr) \
({ \
......@@ -230,7 +250,7 @@ extern int __put_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.
......@@ -274,7 +294,7 @@ copy_to_user(void __user *to, const void *from, unsigned long 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.
......@@ -326,7 +346,8 @@ copy_from_user(void *to, const void __user *from, unsigned long 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
__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.
*/
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
strncpy_from_user(char *dst, const char *src, long count)
strncpy_from_user(char *dst, const char __user *src, long count)
{
long res = -EFAULT;
might_sleep();
......@@ -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
strnlen_user(const char * src, unsigned long n)
strnlen_user(const char __user * src, unsigned long n)
{
might_sleep();
return __strnlen_user_asm(src, n);
......@@ -388,16 +410,16 @@ strnlen_user(const char * src, unsigned long n)
* 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
__clear_user(void *to, unsigned long n)
__clear_user(void __user *to, unsigned long n)
{
return __clear_user_asm(to, n);
}
static inline unsigned long
clear_user(void *to, unsigned long n)
clear_user(void __user *to, unsigned long n)
{
might_sleep();
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