Commit 62a6fa97 authored by Heiko Carstens's avatar Heiko Carstens

kernel/compat: convert to COMPAT_SYSCALL_DEFINE

Convert all compat system call functions where all parameter types
have a size of four or less than four bytes, or are pointer types
to COMPAT_SYSCALL_DEFINE.
The implicit casts within COMPAT_SYSCALL_DEFINE will perform proper
zero and sign extension to 64 bit of all parameters if needed.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 378a10f3
...@@ -110,8 +110,8 @@ static int compat_put_timex(struct compat_timex __user *utp, struct timex *txc) ...@@ -110,8 +110,8 @@ static int compat_put_timex(struct compat_timex __user *utp, struct timex *txc)
return 0; return 0;
} }
asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
struct timezone __user *tz) struct timezone __user *, tz)
{ {
if (tv) { if (tv) {
struct timeval ktv; struct timeval ktv;
...@@ -127,8 +127,8 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, ...@@ -127,8 +127,8 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
return 0; return 0;
} }
asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
struct timezone __user *tz) struct timezone __user *, tz)
{ {
struct timespec kts; struct timespec kts;
struct timezone ktz; struct timezone ktz;
...@@ -236,8 +236,8 @@ static long compat_nanosleep_restart(struct restart_block *restart) ...@@ -236,8 +236,8 @@ static long compat_nanosleep_restart(struct restart_block *restart)
return ret; return ret;
} }
asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
struct compat_timespec __user *rmtp) struct compat_timespec __user *, rmtp)
{ {
struct timespec tu, rmt; struct timespec tu, rmt;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -328,7 +328,7 @@ static compat_clock_t clock_t_to_compat_clock_t(clock_t x) ...@@ -328,7 +328,7 @@ static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
return compat_jiffies_to_clock_t(clock_t_to_jiffies(x)); return compat_jiffies_to_clock_t(clock_t_to_jiffies(x));
} }
asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) COMPAT_SYSCALL_DEFINE1(times, struct compat_tms __user *, tbuf)
{ {
if (tbuf) { if (tbuf) {
struct tms tms; struct tms tms;
...@@ -354,7 +354,7 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) ...@@ -354,7 +354,7 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf)
* types that can be passed to put_user()/get_user(). * types that can be passed to put_user()/get_user().
*/ */
asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set)
{ {
old_sigset_t s; old_sigset_t s;
long ret; long ret;
...@@ -424,8 +424,8 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how, ...@@ -424,8 +424,8 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how,
#endif #endif
asmlinkage long compat_sys_setrlimit(unsigned int resource, COMPAT_SYSCALL_DEFINE2(setrlimit, unsigned int, resource,
struct compat_rlimit __user *rlim) struct compat_rlimit __user *, rlim)
{ {
struct rlimit r; struct rlimit r;
...@@ -443,8 +443,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, ...@@ -443,8 +443,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
#ifdef COMPAT_RLIM_OLD_INFINITY #ifdef COMPAT_RLIM_OLD_INFINITY
asmlinkage long compat_sys_old_getrlimit(unsigned int resource, COMPAT_SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
struct compat_rlimit __user *rlim) struct compat_rlimit __user *, rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
...@@ -470,8 +470,8 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource, ...@@ -470,8 +470,8 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
#endif #endif
asmlinkage long compat_sys_getrlimit(unsigned int resource, COMPAT_SYSCALL_DEFINE2(getrlimit, unsigned int, resource,
struct compat_rlimit __user *rlim) struct compat_rlimit __user *, rlim)
{ {
struct rlimit r; struct rlimit r;
int ret; int ret;
...@@ -596,9 +596,9 @@ static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr, ...@@ -596,9 +596,9 @@ static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr,
return compat_get_bitmap(k, user_mask_ptr, len * 8); return compat_get_bitmap(k, user_mask_ptr, len * 8);
} }
asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, COMPAT_SYSCALL_DEFINE3(sched_setaffinity, compat_pid_t, pid,
unsigned int len, unsigned int, len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *, user_mask_ptr)
{ {
cpumask_var_t new_mask; cpumask_var_t new_mask;
int retval; int retval;
...@@ -616,8 +616,8 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, ...@@ -616,8 +616,8 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
return retval; return retval;
} }
asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, COMPAT_SYSCALL_DEFINE3(sched_getaffinity, compat_pid_t, pid, unsigned int, len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *, user_mask_ptr)
{ {
int ret; int ret;
cpumask_var_t mask; cpumask_var_t mask;
...@@ -662,9 +662,9 @@ int put_compat_itimerspec(struct compat_itimerspec __user *dst, ...@@ -662,9 +662,9 @@ int put_compat_itimerspec(struct compat_itimerspec __user *dst,
return 0; return 0;
} }
long compat_sys_timer_create(clockid_t which_clock, COMPAT_SYSCALL_DEFINE3(timer_create, clockid_t, which_clock,
struct compat_sigevent __user *timer_event_spec, struct compat_sigevent __user *, timer_event_spec,
timer_t __user *created_timer_id) timer_t __user *, created_timer_id)
{ {
struct sigevent __user *event = NULL; struct sigevent __user *event = NULL;
...@@ -680,9 +680,9 @@ long compat_sys_timer_create(clockid_t which_clock, ...@@ -680,9 +680,9 @@ long compat_sys_timer_create(clockid_t which_clock,
return sys_timer_create(which_clock, event, created_timer_id); return sys_timer_create(which_clock, event, created_timer_id);
} }
long compat_sys_timer_settime(timer_t timer_id, int flags, COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
struct compat_itimerspec __user *new, struct compat_itimerspec __user *, new,
struct compat_itimerspec __user *old) struct compat_itimerspec __user *, old)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -703,8 +703,8 @@ long compat_sys_timer_settime(timer_t timer_id, int flags, ...@@ -703,8 +703,8 @@ long compat_sys_timer_settime(timer_t timer_id, int flags,
return err; return err;
} }
long compat_sys_timer_gettime(timer_t timer_id, COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
struct compat_itimerspec __user *setting) struct compat_itimerspec __user *, setting)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -720,8 +720,8 @@ long compat_sys_timer_gettime(timer_t timer_id, ...@@ -720,8 +720,8 @@ long compat_sys_timer_gettime(timer_t timer_id,
return err; return err;
} }
long compat_sys_clock_settime(clockid_t which_clock, COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
struct compat_timespec __user *tp) struct compat_timespec __user *, tp)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -737,8 +737,8 @@ long compat_sys_clock_settime(clockid_t which_clock, ...@@ -737,8 +737,8 @@ long compat_sys_clock_settime(clockid_t which_clock,
return err; return err;
} }
long compat_sys_clock_gettime(clockid_t which_clock, COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
struct compat_timespec __user *tp) struct compat_timespec __user *, tp)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -754,8 +754,8 @@ long compat_sys_clock_gettime(clockid_t which_clock, ...@@ -754,8 +754,8 @@ long compat_sys_clock_gettime(clockid_t which_clock,
return err; return err;
} }
long compat_sys_clock_adjtime(clockid_t which_clock, COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
struct compat_timex __user *utp) struct compat_timex __user *, utp)
{ {
struct timex txc; struct timex txc;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -777,8 +777,8 @@ long compat_sys_clock_adjtime(clockid_t which_clock, ...@@ -777,8 +777,8 @@ long compat_sys_clock_adjtime(clockid_t which_clock,
return ret; return ret;
} }
long compat_sys_clock_getres(clockid_t which_clock, COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
struct compat_timespec __user *tp) struct compat_timespec __user *, tp)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -818,9 +818,9 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart) ...@@ -818,9 +818,9 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart)
return err; return err;
} }
long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
struct compat_timespec __user *rqtp, struct compat_timespec __user *, rqtp,
struct compat_timespec __user *rmtp) struct compat_timespec __user *, rmtp)
{ {
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
...@@ -1010,7 +1010,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, ...@@ -1010,7 +1010,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
/* compat_time_t is a 32 bit "long" and needs to get converted. */ /* compat_time_t is a 32 bit "long" and needs to get converted. */
asmlinkage long compat_sys_time(compat_time_t __user * tloc) COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
{ {
compat_time_t i; compat_time_t i;
struct timeval tv; struct timeval tv;
...@@ -1026,7 +1026,7 @@ asmlinkage long compat_sys_time(compat_time_t __user * tloc) ...@@ -1026,7 +1026,7 @@ asmlinkage long compat_sys_time(compat_time_t __user * tloc)
return i; return i;
} }
asmlinkage long compat_sys_stime(compat_time_t __user *tptr) COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr)
{ {
struct timespec tv; struct timespec tv;
int err; int err;
...@@ -1046,7 +1046,7 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr) ...@@ -1046,7 +1046,7 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr)
#endif /* __ARCH_WANT_COMPAT_SYS_TIME */ #endif /* __ARCH_WANT_COMPAT_SYS_TIME */
asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) COMPAT_SYSCALL_DEFINE1(adjtimex, struct compat_timex __user *, utp)
{ {
struct timex txc; struct timex txc;
int err, ret; int err, ret;
...@@ -1085,10 +1085,10 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages, ...@@ -1085,10 +1085,10 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages,
return sys_move_pages(pid, nr_pages, pages, nodes, status, flags); return sys_move_pages(pid, nr_pages, pages, nodes, status, flags);
} }
asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, COMPAT_SYSCALL_DEFINE4(migrate_pages, compat_pid_t, pid,
compat_ulong_t maxnode, compat_ulong_t, maxnode,
const compat_ulong_t __user *old_nodes, const compat_ulong_t __user *, old_nodes,
const compat_ulong_t __user *new_nodes) const compat_ulong_t __user *, new_nodes)
{ {
unsigned long __user *old = NULL; unsigned long __user *old = NULL;
unsigned long __user *new = NULL; unsigned long __user *new = NULL;
......
...@@ -1180,8 +1180,8 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request, ...@@ -1180,8 +1180,8 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
return ret; return ret;
} }
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, COMPAT_SYSCALL_DEFINE4(ptrace, compat_long_t, request, compat_long_t, pid,
compat_long_t addr, compat_long_t data) compat_long_t, addr, compat_long_t, data)
{ {
struct task_struct *child; struct task_struct *child;
long ret; long ret;
......
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