Commit 4d338e1a authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] uml: sparse cleanups

misc sparse annotations
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 694a464e
...@@ -104,7 +104,7 @@ static int harddog_release(struct inode *inode, struct file *file) ...@@ -104,7 +104,7 @@ static int harddog_release(struct inode *inode, struct file *file)
extern int ping_watchdog(int fd); extern int ping_watchdog(int fd);
static ssize_t harddog_write(struct file *file, const char *data, size_t len, static ssize_t harddog_write(struct file *file, const char __user *data, size_t len,
loff_t *ppos) loff_t *ppos)
{ {
/* /*
...@@ -118,6 +118,7 @@ static ssize_t harddog_write(struct file *file, const char *data, size_t len, ...@@ -118,6 +118,7 @@ static ssize_t harddog_write(struct file *file, const char *data, size_t len,
static int harddog_ioctl(struct inode *inode, struct file *file, static int harddog_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp= (void __user *)arg;
static struct watchdog_info ident = { static struct watchdog_info ident = {
WDIOC_SETTIMEOUT, WDIOC_SETTIMEOUT,
0, 0,
...@@ -127,13 +128,12 @@ static int harddog_ioctl(struct inode *inode, struct file *file, ...@@ -127,13 +128,12 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
default: default:
return -ENOTTY; return -ENOTTY;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if(copy_to_user((struct harddog_info *)arg, &ident, if(copy_to_user(argp, &ident, sizeof(ident)))
sizeof(ident)))
return -EFAULT; return -EFAULT;
return 0; return 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0,(int *)arg); return put_user(0,(int __user *)argp);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
return(ping_watchdog(harddog_out_fd)); return(ping_watchdog(harddog_out_fd));
} }
......
...@@ -67,8 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP); ...@@ -67,8 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP);
/* /dev/dsp file operations */ /* /dev/dsp file operations */
static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, static ssize_t hostaudio_read(struct file *file, char __user *buffer,
loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct hostaudio_state *state = file->private_data; struct hostaudio_state *state = file->private_data;
void *kbuf; void *kbuf;
...@@ -94,7 +94,7 @@ static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, ...@@ -94,7 +94,7 @@ static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count,
return(err); return(err);
} }
static ssize_t hostaudio_write(struct file *file, const char *buffer, static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct hostaudio_state *state = file->private_data; struct hostaudio_state *state = file->private_data;
...@@ -152,7 +152,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file, ...@@ -152,7 +152,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_CHANNELS:
case SNDCTL_DSP_SUBDIVIDE: case SNDCTL_DSP_SUBDIVIDE:
case SNDCTL_DSP_SETFRAGMENT: case SNDCTL_DSP_SETFRAGMENT:
if(get_user(data, (int *) arg)) if(get_user(data, (int __user *) arg))
return(-EFAULT); return(-EFAULT);
break; break;
default: default:
...@@ -168,7 +168,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file, ...@@ -168,7 +168,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_CHANNELS:
case SNDCTL_DSP_SUBDIVIDE: case SNDCTL_DSP_SUBDIVIDE:
case SNDCTL_DSP_SETFRAGMENT: case SNDCTL_DSP_SETFRAGMENT:
if(put_user(data, (int *) arg)) if(put_user(data, (int __user *) arg))
return(-EFAULT); return(-EFAULT);
break; break;
default: default:
......
...@@ -77,7 +77,7 @@ static int slirp_setup(char *str, char **mac_out, void *data) ...@@ -77,7 +77,7 @@ static int slirp_setup(char *str, char **mac_out, void *data)
int i=0; int i=0;
*init = ((struct slirp_init) *init = ((struct slirp_init)
{ argw : { { "slirp", NULL } } }); { .argw = { { "slirp", NULL } } });
str = split_if_spec(str, mac_out, NULL); str = split_if_spec(str, mac_out, NULL);
......
...@@ -58,23 +58,17 @@ struct line { ...@@ -58,23 +58,17 @@ struct line {
}; };
#define LINE_INIT(str, d) \ #define LINE_INIT(str, d) \
{ init_str : str, \ { .init_str = str, \
init_pri : INIT_STATIC, \ .init_pri = INIT_STATIC, \
valid : 1, \ .valid = 1, \
throttled : 0, \ .lock = SPIN_LOCK_UNLOCKED, \
lock : SPIN_LOCK_UNLOCKED, \ .driver = d }
buffer : NULL, \
head : NULL, \
tail : NULL, \
sigio : 0, \
driver : d, \
have_irq : 0 }
struct lines { struct lines {
int num; int num;
}; };
#define LINES_INIT(n) { num : n } #define LINES_INIT(n) { .num = n }
extern void line_close(struct tty_struct *tty, struct file * filp); extern void line_close(struct tty_struct *tty, struct file * filp);
extern int line_open(struct line *lines, struct tty_struct *tty); extern int line_open(struct line *lines, struct tty_struct *tty);
......
...@@ -48,7 +48,8 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char * ...@@ -48,7 +48,8 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *
*/ */
static __inline__ static __inline__
unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
unsigned char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if(copy_from_user(dst, src, len)){ if(copy_from_user(dst, src, len)){
...@@ -192,7 +193,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, ...@@ -192,7 +193,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src, static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
unsigned char *dst, unsigned char __user *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if (access_ok(VERIFY_WRITE, dst, len)){ if (access_ok(VERIFY_WRITE, dst, len)){
......
...@@ -58,14 +58,14 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env) ...@@ -58,14 +58,14 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
return(err); return(err);
} }
long sys_execve(char *file, char __user *__user *argv, long sys_execve(char __user *file, char __user *__user *argv,
char __user *__user *env) char __user *__user *env)
{ {
long error; long error;
char *filename; char *filename;
lock_kernel(); lock_kernel();
filename = getname((char __user *) file); filename = getname(file);
error = PTR_ERR(filename); error = PTR_ERR(filename);
if (IS_ERR(filename)) goto out; if (IS_ERR(filename)) goto out;
error = execve1(filename, argv, env); error = execve1(filename, argv, env);
......
...@@ -407,7 +407,7 @@ static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int ...@@ -407,7 +407,7 @@ static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int
return strlen(buf); return strlen(buf);
} }
static int proc_write_sysemu(struct file *file,const char *buf, unsigned long count,void *data) static int proc_write_sysemu(struct file *file,const char __user *buf, unsigned long count,void *data)
{ {
char tmp[2]; char tmp[2];
......
...@@ -46,6 +46,7 @@ extern int poke_user(struct task_struct * child, long addr, long data); ...@@ -46,6 +46,7 @@ extern int poke_user(struct task_struct * child, long addr, long data);
long arch_ptrace(struct task_struct *child, long request, long addr, long data) long arch_ptrace(struct task_struct *child, long request, long addr, long data)
{ {
int i, ret; int i, ret;
unsigned long __user *p = (void __user *)(unsigned long)data;
switch (request) { switch (request) {
/* when I and D space are separate, these will need to be fixed. */ /* when I and D space are separate, these will need to be fixed. */
...@@ -58,7 +59,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -58,7 +59,7 @@ long arch_ptrace(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))
break; break;
ret = put_user(tmp, (unsigned long __user *) data); ret = put_user(tmp, p);
break; break;
} }
...@@ -136,15 +137,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -136,15 +137,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
#ifdef PTRACE_GETREGS #ifdef PTRACE_GETREGS
case PTRACE_GETREGS: { /* Get all gp regs from the child. */ case PTRACE_GETREGS: { /* Get all gp regs from the child. */
if (!access_ok(VERIFY_WRITE, (unsigned long *)data, if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
MAX_REG_OFFSET)) {
ret = -EIO; ret = -EIO;
break; break;
} }
for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
__put_user(getreg(child, i), __put_user(getreg(child, i), p);
(unsigned long __user *) data); p++;
data += sizeof(long);
} }
ret = 0; ret = 0;
break; break;
...@@ -153,15 +152,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -153,15 +152,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
#ifdef PTRACE_SETREGS #ifdef PTRACE_SETREGS
case PTRACE_SETREGS: { /* Set all gp regs in the child. */ case PTRACE_SETREGS: { /* Set all gp regs in the child. */
unsigned long tmp = 0; unsigned long tmp = 0;
if (!access_ok(VERIFY_READ, (unsigned *)data, if (!access_ok(VERIFY_READ, p, MAX_REG_OFFSET)) {
MAX_REG_OFFSET)) {
ret = -EIO; ret = -EIO;
break; break;
} }
for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
__get_user(tmp, (unsigned long __user *) data); __get_user(tmp, p);
putreg(child, i, tmp); putreg(child, i, tmp);
data += sizeof(long); p++;
} }
ret = 0; ret = 0;
break; break;
...@@ -192,8 +190,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -192,8 +190,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* but transfer max. sizeof(struct ptrace_faultinfo). * but transfer max. sizeof(struct ptrace_faultinfo).
* On i386, ptrace_faultinfo is smaller! * On i386, ptrace_faultinfo is smaller!
*/ */
ret = copy_to_user((unsigned long __user *) data, ret = copy_to_user(p, &child->thread.arch.faultinfo,
&child->thread.arch.faultinfo,
sizeof(struct ptrace_faultinfo)); sizeof(struct ptrace_faultinfo));
if(ret) if(ret)
break; break;
...@@ -204,8 +201,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -204,8 +201,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
case PTRACE_LDT: { case PTRACE_LDT: {
struct ptrace_ldt ldt; struct ptrace_ldt ldt;
if(copy_from_user(&ldt, (unsigned long __user *) data, if(copy_from_user(&ldt, p, sizeof(ldt))){
sizeof(ldt))){
ret = -EIO; ret = -EIO;
break; break;
} }
......
...@@ -104,7 +104,7 @@ long sys_pipe(unsigned long __user * fildes) ...@@ -104,7 +104,7 @@ long sys_pipe(unsigned long __user * fildes)
} }
long sys_uname(struct old_utsname * name) long sys_uname(struct old_utsname __user * name)
{ {
long err; long err;
if (!name) if (!name)
...@@ -115,7 +115,7 @@ long sys_uname(struct old_utsname * name) ...@@ -115,7 +115,7 @@ long sys_uname(struct old_utsname * name)
return err?-EFAULT:0; return err?-EFAULT:0;
} }
long sys_olduname(struct oldold_utsname * name) long sys_olduname(struct oldold_utsname __user * name)
{ {
long error; long error;
......
...@@ -198,7 +198,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) ...@@ -198,7 +198,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
si.si_signo = SIGBUS; si.si_signo = SIGBUS;
si.si_errno = 0; si.si_errno = 0;
si.si_code = BUS_ADRERR; si.si_code = BUS_ADRERR;
si.si_addr = (void *)address; si.si_addr = (void __user *)address;
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_info(SIGBUS, &si, current); force_sig_info(SIGBUS, &si, current);
} else if (err == -ENOMEM) { } else if (err == -ENOMEM) {
...@@ -207,7 +207,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) ...@@ -207,7 +207,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
} else { } else {
BUG_ON(err != -EFAULT); BUG_ON(err != -EFAULT);
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_addr = (void *) address; si.si_addr = (void __user *) address;
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
} }
...@@ -220,7 +220,7 @@ void bad_segv(struct faultinfo fi, unsigned long ip) ...@@ -220,7 +220,7 @@ void bad_segv(struct faultinfo fi, unsigned long ip)
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_code = SEGV_ACCERR; si.si_code = SEGV_ACCERR;
si.si_addr = (void *) FAULT_ADDRESS(fi); si.si_addr = (void __user *) FAULT_ADDRESS(fi);
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
} }
......
...@@ -139,7 +139,7 @@ int peek_user(struct task_struct *child, long addr, long data) ...@@ -139,7 +139,7 @@ int peek_user(struct task_struct *child, long addr, long data)
addr = addr >> 2; addr = addr >> 2;
tmp = child->thread.arch.debugregs[addr]; tmp = child->thread.arch.debugregs[addr];
} }
return put_user(tmp, (unsigned long *) data); return put_user(tmp, (unsigned long __user *) data);
} }
struct i387_fxsave_struct { struct i387_fxsave_struct {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "skas.h" #include "skas.h"
static int copy_sc_from_user_skas(struct pt_regs *regs, static int copy_sc_from_user_skas(struct pt_regs *regs,
struct sigcontext *from) struct sigcontext __user *from)
{ {
struct sigcontext sc; struct sigcontext sc;
unsigned long fpregs[HOST_FP_SIZE]; unsigned long fpregs[HOST_FP_SIZE];
...@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, ...@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
return(0); return(0);
} }
int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp,
struct pt_regs *regs, unsigned long sp) struct pt_regs *regs, unsigned long sp)
{ {
struct sigcontext sc; struct sigcontext sc;
...@@ -92,7 +92,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, ...@@ -92,7 +92,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
"errno = %d\n", err); "errno = %d\n", err);
return(1); return(1);
} }
to_fp = (to_fp ? to_fp : (struct _fpstate *) (to + 1)); to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
sc.fpstate = to_fp; sc.fpstate = to_fp;
if(err) if(err)
...@@ -113,10 +113,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, ...@@ -113,10 +113,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
* saved pointer is in the kernel, but the sigcontext is in userspace, so we * saved pointer is in the kernel, but the sigcontext is in userspace, so we
* copy_to_user it. * copy_to_user it.
*/ */
int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
int fpsize) int fpsize)
{ {
struct _fpstate *to_fp, *from_fp; struct _fpstate *to_fp;
struct _fpstate __user *from_fp;
unsigned long sigs; unsigned long sigs;
int err; int err;
...@@ -131,13 +132,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, ...@@ -131,13 +132,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
return(err); return(err);
} }
int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp,
struct sigcontext *from, int fpsize, unsigned long sp) struct sigcontext *from, int fpsize, unsigned long sp)
{ {
struct _fpstate *to_fp, *from_fp; struct _fpstate __user *to_fp;
struct _fpstate *from_fp;
int err; int err;
to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
from_fp = from->fpstate; from_fp = from->fpstate;
err = copy_to_user(to, from, sizeof(*to)); err = copy_to_user(to, from, sizeof(*to));
...@@ -165,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) ...@@ -165,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
return(ret); return(ret);
} }
static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp,
struct pt_regs *from, unsigned long sp) struct pt_regs *from, unsigned long sp)
{ {
return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
...@@ -173,7 +175,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, ...@@ -173,7 +175,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
copy_sc_to_user_skas(to, fp, from, sp))); copy_sc_to_user_skas(to, fp, from, sp)));
} }
static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp, static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp,
sigset_t *set, unsigned long sp) sigset_t *set, unsigned long sp)
{ {
int err = 0; int err = 0;
...@@ -188,7 +190,7 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp, ...@@ -188,7 +190,7 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
struct sigframe struct sigframe
{ {
char *pretcode; char __user *pretcode;
int sig; int sig;
struct sigcontext sc; struct sigcontext sc;
struct _fpstate fpstate; struct _fpstate fpstate;
...@@ -198,10 +200,10 @@ struct sigframe ...@@ -198,10 +200,10 @@ struct sigframe
struct rt_sigframe struct rt_sigframe
{ {
char *pretcode; char __user *pretcode;
int sig; int sig;
struct siginfo *pinfo; struct siginfo __user *pinfo;
void *puc; void __user *puc;
struct siginfo info; struct siginfo info;
struct ucontext uc; struct ucontext uc;
struct _fpstate fpstate; struct _fpstate fpstate;
...@@ -213,16 +215,16 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, ...@@ -213,16 +215,16 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
sigset_t *mask) sigset_t *mask)
{ {
struct sigframe __user *frame; struct sigframe __user *frame;
void *restorer; void __user *restorer;
unsigned long save_sp = PT_REGS_SP(regs); unsigned long save_sp = PT_REGS_SP(regs);
int err = 0; int err = 0;
stack_top &= -8UL; stack_top &= -8UL;
frame = (struct sigframe *) stack_top - 1; frame = (struct sigframe __user *) stack_top - 1;
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return 1; return 1;
restorer = (void *) frame->retcode; restorer = frame->retcode;
if(ka->sa.sa_flags & SA_RESTORER) if(ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ka->sa.sa_restorer;
...@@ -278,16 +280,16 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, ...@@ -278,16 +280,16 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
siginfo_t *info, sigset_t *mask) siginfo_t *info, sigset_t *mask)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
void *restorer; void __user *restorer;
unsigned long save_sp = PT_REGS_SP(regs); unsigned long save_sp = PT_REGS_SP(regs);
int err = 0; int err = 0;
stack_top &= -8UL; stack_top &= -8UL;
frame = (struct rt_sigframe *) stack_top - 1; frame = (struct rt_sigframe __user *) stack_top - 1;
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return 1; return 1;
restorer = (void *) frame->retcode; restorer = frame->retcode;
if(ka->sa.sa_flags & SA_RESTORER) if(ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ka->sa.sa_restorer;
...@@ -333,7 +335,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, ...@@ -333,7 +335,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
long sys_sigreturn(struct pt_regs regs) long sys_sigreturn(struct pt_regs regs)
{ {
unsigned long sp = PT_REGS_SP(&current->thread.regs); unsigned long sp = PT_REGS_SP(&current->thread.regs);
struct sigframe __user *frame = (struct sigframe *)(sp - 8); struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
sigset_t set; sigset_t set;
struct sigcontext __user *sc = &frame->sc; struct sigcontext __user *sc = &frame->sc;
unsigned long __user *oldmask = &sc->oldmask; unsigned long __user *oldmask = &sc->oldmask;
...@@ -365,8 +367,8 @@ long sys_sigreturn(struct pt_regs regs) ...@@ -365,8 +367,8 @@ long sys_sigreturn(struct pt_regs regs)
long sys_rt_sigreturn(struct pt_regs regs) long sys_rt_sigreturn(struct pt_regs regs)
{ {
unsigned long __user sp = PT_REGS_SP(&current->thread.regs); unsigned long sp = PT_REGS_SP(&current->thread.regs);
struct rt_sigframe __user *frame = (struct rt_sigframe *) (sp - 4); struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (sp - 4);
sigset_t set; sigset_t set;
struct ucontext __user *uc = &frame->uc; struct ucontext __user *uc = &frame->uc;
int sig_size = _NSIG_WORDS * sizeof(unsigned long); int sig_size = _NSIG_WORDS * sizeof(unsigned long);
......
...@@ -104,7 +104,7 @@ long sys_ipc (uint call, int first, int second, ...@@ -104,7 +104,7 @@ long sys_ipc (uint call, int first, int second,
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);
} }
......
...@@ -28,7 +28,7 @@ struct pt_regs { ...@@ -28,7 +28,7 @@ struct pt_regs {
union uml_pt_regs regs; union uml_pt_regs regs;
}; };
#define EMPTY_REGS { regs : EMPTY_UML_PT_REGS } #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }
#define PT_REGS_IP(r) UPT_IP(&(r)->regs) #define PT_REGS_IP(r) UPT_IP(&(r)->regs)
#define PT_REGS_SP(r) UPT_SP(&(r)->regs) #define PT_REGS_SP(r) UPT_SP(&(r)->regs)
......
...@@ -27,14 +27,14 @@ struct thread_info { ...@@ -27,14 +27,14 @@ struct thread_info {
#define INIT_THREAD_INFO(tsk) \ #define INIT_THREAD_INFO(tsk) \
{ \ { \
task: &tsk, \ .task = &tsk, \
exec_domain: &default_exec_domain, \ .exec_domain = &default_exec_domain, \
flags: 0, \ .flags = 0, \
cpu: 0, \ .cpu = 0, \
preempt_count: 1, \ .preempt_count = 1, \
addr_limit: KERNEL_DS, \ .addr_limit = KERNEL_DS, \
restart_block: { \ .restart_block = { \
fn: do_no_restart_syscall, \ .fn = do_no_restart_syscall, \
}, \ }, \
} }
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
({ \ ({ \
const __typeof__((*(ptr))) __user *private_ptr = (ptr); \ const __typeof__((*(ptr))) __user *private_ptr = (ptr); \
(access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \ (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
__get_user(x, private_ptr) : ((x) = 0, -EFAULT)); \ __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \
}) })
#define __put_user(x, ptr) \ #define __put_user(x, ptr) \
......
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