diff options
author | Alexander Viro <viro@www.linux.org.uk> | 2004-05-28 21:15:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-28 21:15:01 -0700 |
commit | a2e80cf8d96b767bc62e735c0afcf374eb8f82e5 (patch) | |
tree | 48aa313e497cd78842bafbe828acec72ec1d8ee9 /kernel | |
parent | c4787237d4800bbf8f1cbf758a51b2850552af42 (diff) | |
download | history-a2e80cf8d96b767bc62e735c0afcf374eb8f82e5.tar.gz |
[PATCH] sparse: trivial part of kernel/* __user annotation
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/acct.c | 2 | ||||
-rw-r--r-- | kernel/compat.c | 77 | ||||
-rw-r--r-- | kernel/exit.c | 11 | ||||
-rw-r--r-- | kernel/futex.c | 2 | ||||
-rw-r--r-- | kernel/sys.c | 4 | ||||
-rw-r--r-- | kernel/time.c | 4 |
6 files changed, 55 insertions, 45 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 555e1e3c349ffb..f0e2bd0458d2f4 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -204,7 +204,7 @@ void acct_file_reopen(struct file *file) * should be written. If the filename is NULL, accounting will be * shutdown. */ -asmlinkage long sys_acct(const char *name) +asmlinkage long sys_acct(const char __user *name) { struct file *file = NULL; char *tmp; diff --git a/kernel/compat.c b/kernel/compat.c index f05cda344b4d3f..9dccddd331a39f 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -23,14 +23,14 @@ #include <asm/uaccess.h> -int get_compat_timespec(struct timespec *ts, const struct compat_timespec *cts) +int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) { return (verify_area(VERIFY_READ, cts, sizeof(*cts)) || __get_user(ts->tv_sec, &cts->tv_sec) || __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; } -int put_compat_timespec(const struct timespec *ts, struct compat_timespec *cts) +int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts) { return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) || __put_user(ts->tv_sec, &cts->tv_sec) || @@ -40,7 +40,7 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec *cts) static long compat_nanosleep_restart(struct restart_block *restart) { unsigned long expire = restart->arg0, now = jiffies; - struct compat_timespec *rmtp; + struct compat_timespec __user *rmtp; /* Did it expire while we handled signals? */ if (!time_after(expire, now)) @@ -51,7 +51,7 @@ static long compat_nanosleep_restart(struct restart_block *restart) if (expire == 0) return 0; - rmtp = (struct compat_timespec *)restart->arg1; + rmtp = (struct compat_timespec __user *)restart->arg1; if (rmtp) { struct compat_timespec ct; struct timespec t; @@ -66,8 +66,8 @@ static long compat_nanosleep_restart(struct restart_block *restart) return -ERESTART_RESTARTBLOCK; } -asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp, - struct compat_timespec *rmtp) +asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, + struct compat_timespec __user *rmtp) { struct timespec t; struct restart_block *restart; @@ -98,7 +98,7 @@ asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp, } static inline long get_compat_itimerval(struct itimerval *o, - struct compat_itimerval *i) + struct compat_itimerval __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) | @@ -107,7 +107,7 @@ static inline long get_compat_itimerval(struct itimerval *o, __get_user(o->it_value.tv_usec, &i->it_value.tv_usec))); } -static inline long put_compat_itimerval(struct compat_itimerval *o, +static inline long put_compat_itimerval(struct compat_itimerval __user *o, struct itimerval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || @@ -117,7 +117,8 @@ static inline long put_compat_itimerval(struct compat_itimerval *o, __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); } -asmlinkage long compat_sys_getitimer(int which, struct compat_itimerval *it) +asmlinkage long compat_sys_getitimer(int which, + struct compat_itimerval __user *it) { struct itimerval kit; int error; @@ -128,8 +129,9 @@ asmlinkage long compat_sys_getitimer(int which, struct compat_itimerval *it) return error; } -asmlinkage long compat_sys_setitimer(int which, struct compat_itimerval *in, - struct compat_itimerval *out) +asmlinkage long compat_sys_setitimer(int which, + struct compat_itimerval __user *in, + struct compat_itimerval __user *out) { struct itimerval kin, kout; int error; @@ -148,7 +150,7 @@ asmlinkage long compat_sys_setitimer(int which, struct compat_itimerval *in, return 0; } -asmlinkage long compat_sys_times(struct compat_tms *tbuf) +asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) { /* * In the SMP world we might just be unlucky and have one of @@ -173,7 +175,7 @@ asmlinkage long compat_sys_times(struct compat_tms *tbuf) * types that can be passed to put_user()/get_user(). */ -asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set) +asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) { old_sigset_t s; long ret; @@ -187,8 +189,8 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set) return ret; } -asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t *set, - compat_old_sigset_t *oset) +asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, + compat_old_sigset_t __user *oset) { old_sigset_t s; long ret; @@ -207,8 +209,8 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t *set, } #ifdef CONFIG_FUTEX -asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val, - struct compat_timespec *utime, u32 *uaddr2) +asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val, + struct compat_timespec __user *utime, u32 __user *uaddr2) { struct timespec t; unsigned long timeout = MAX_SCHEDULE_TIMEOUT; @@ -227,7 +229,8 @@ asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val, } #endif -asmlinkage long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit *rlim) +asmlinkage long compat_sys_setrlimit(unsigned int resource, + struct compat_rlimit __user *rlim) { struct rlimit r; int ret; @@ -253,7 +256,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit #ifdef COMPAT_RLIM_OLD_INFINITY -asmlinkage long compat_sys_old_getrlimit(unsigned int resource, struct compat_rlimit *rlim) +asmlinkage long compat_sys_old_getrlimit(unsigned int resource, + struct compat_rlimit __user *rlim) { struct rlimit r; int ret; @@ -279,7 +283,8 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource, struct compat_rl #endif -asmlinkage long compat_sys_getrlimit (unsigned int resource, struct compat_rlimit *rlim) +asmlinkage long compat_sys_getrlimit (unsigned int resource, + struct compat_rlimit __user *rlim) { struct rlimit r; int ret; @@ -302,7 +307,7 @@ asmlinkage long compat_sys_getrlimit (unsigned int resource, struct compat_rlimi return ret; } -static long put_compat_rusage (struct compat_rusage *ru, struct rusage *r) +static long put_compat_rusage(struct compat_rusage __user *ru, struct rusage *r) { if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) || __put_user(r->ru_utime.tv_sec, &ru->ru_utime.tv_sec) || @@ -327,7 +332,7 @@ static long put_compat_rusage (struct compat_rusage *ru, struct rusage *r) return 0; } -asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru) +asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru) { struct rusage r; int ret; @@ -347,8 +352,8 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru) } asmlinkage long -compat_sys_wait4(compat_pid_t pid, compat_uint_t * stat_addr, int options, - struct compat_rusage *ru) +compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, + struct compat_rusage __user *ru) { if (!ru) { return sys_wait4(pid, stat_addr, options, NULL); @@ -374,7 +379,7 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t * stat_addr, int options, asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, unsigned int len, - compat_ulong_t *user_mask_ptr) + compat_ulong_t __user *user_mask_ptr) { unsigned long kernel_mask; mm_segment_t old_fs; @@ -394,7 +399,7 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, } asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, - compat_ulong_t *user_mask_ptr) + compat_ulong_t __user *user_mask_ptr) { unsigned long kernel_mask; mm_segment_t old_fs; @@ -417,7 +422,7 @@ asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, } static int get_compat_itimerspec(struct itimerspec *dst, - struct compat_itimerspec *src) + struct compat_itimerspec __user *src) { if (get_compat_timespec(&dst->it_interval, &src->it_interval) || get_compat_timespec(&dst->it_value, &src->it_value)) @@ -425,7 +430,7 @@ static int get_compat_itimerspec(struct itimerspec *dst, return 0; } -static int put_compat_itimerspec(struct compat_itimerspec *dst, +static int put_compat_itimerspec(struct compat_itimerspec __user *dst, struct itimerspec *src) { if (put_compat_timespec(&src->it_interval, &dst->it_interval) || @@ -435,8 +440,8 @@ static int put_compat_itimerspec(struct compat_itimerspec *dst, } long compat_timer_settime(timer_t timer_id, int flags, - struct compat_itimerspec *new, - struct compat_itimerspec *old) + struct compat_itimerspec __user *new, + struct compat_itimerspec __user *old) { long err; mm_segment_t oldfs; @@ -455,7 +460,8 @@ long compat_timer_settime(timer_t timer_id, int flags, return err; } -long compat_timer_gettime(timer_t timer_id, struct compat_itimerspec *setting) +long compat_timer_gettime(timer_t timer_id, + struct compat_itimerspec __user *setting) { long err; mm_segment_t oldfs; @@ -469,7 +475,8 @@ long compat_timer_gettime(timer_t timer_id, struct compat_itimerspec *setting) return err; } -long compat_clock_settime(clockid_t which_clock, struct compat_timespec *tp) +long compat_clock_settime(clockid_t which_clock, + struct compat_timespec __user *tp) { long err; mm_segment_t oldfs; @@ -483,7 +490,8 @@ long compat_clock_settime(clockid_t which_clock, struct compat_timespec *tp) return err; } -long compat_clock_gettime(clockid_t which_clock, struct compat_timespec *tp) +long compat_clock_gettime(clockid_t which_clock, + struct compat_timespec __user *tp) { long err; mm_segment_t oldfs; @@ -497,7 +505,8 @@ long compat_clock_gettime(clockid_t which_clock, struct compat_timespec *tp) return err; } -long compat_clock_getres(clockid_t which_clock, struct compat_timespec *tp) +long compat_clock_getres(clockid_t which_clock, + struct compat_timespec __user *tp) { long err; mm_segment_t oldfs; diff --git a/kernel/exit.c b/kernel/exit.c index 1053be962cad5f..8c1a599db266e1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -32,7 +32,7 @@ extern void sem_exit (void); extern struct task_struct *child_reaper; -int getrusage(struct task_struct *, int, struct rusage *); +int getrusage(struct task_struct *, int, struct rusage __user *); static void __unhash_process(struct task_struct *p) { @@ -936,7 +936,7 @@ static int eligible_child(pid_t pid, int options, task_t *p) * the lock and this task is uninteresting. If we return nonzero, we have * released the lock and the system call should return. */ -static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *ru) +static int wait_task_zombie(task_t *p, unsigned int __user *stat_addr, struct rusage __user *ru) { unsigned long state; int retval; @@ -1009,7 +1009,8 @@ static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *r * released the lock and the system call should return. */ static int wait_task_stopped(task_t *p, int delayed_group_leader, - unsigned int *stat_addr, struct rusage *ru) + unsigned int __user *stat_addr, + struct rusage __user *ru) { int retval, exit_code; @@ -1079,7 +1080,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, return retval; } -asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru) +asmlinkage long sys_wait4(pid_t pid,unsigned int __user *stat_addr, int options, struct rusage __user *ru) { DECLARE_WAITQUEUE(wait, current); struct task_struct *tsk; @@ -1168,7 +1169,7 @@ end_wait4: * sys_waitpid() remains for compatibility. waitpid() should be * implemented by calling sys_wait4() from libc.a. */ -asmlinkage long sys_waitpid(pid_t pid,unsigned int * stat_addr, int options) +asmlinkage long sys_waitpid(pid_t pid, unsigned __user *stat_addr, int options) { return sys_wait4(pid, stat_addr, options, NULL); } diff --git a/kernel/futex.c b/kernel/futex.c index 93f7ea6f80be4f..18d5119d27ba7f 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -459,7 +459,7 @@ static int futex_wait(unsigned long uaddr, int val, unsigned long time) * We hold the mmap semaphore, so the mapping cannot have changed * since we looked it up. */ - if (get_user(curval, (int *)uaddr) != 0) { + if (get_user(curval, (int __user *)uaddr) != 0) { ret = -EFAULT; goto out_unqueue; } diff --git a/kernel/sys.c b/kernel/sys.c index 769b86f0e663ec..d22fd2d124a8da 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -819,7 +819,7 @@ asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES); } -asmlinkage long sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) +asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid) { int retval; @@ -868,7 +868,7 @@ asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) return 0; } -asmlinkage long sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) +asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid) { int retval; diff --git a/kernel/time.c b/kernel/time.c index f60c5da45723b8..68c22f2bf45272 100644 --- a/kernel/time.c +++ b/kernel/time.c @@ -49,7 +49,7 @@ EXPORT_SYMBOL(sys_tz); * * XXX This function is NOT 64-bit clean! */ -asmlinkage long sys_time(int * tloc) +asmlinkage long sys_time(int __user * tloc) { int i; struct timeval tv; @@ -71,7 +71,7 @@ asmlinkage long sys_time(int * tloc) * architectures that need it). */ -asmlinkage long sys_stime(time_t *tptr) +asmlinkage long sys_stime(time_t __user *tptr) { struct timespec tv; |