Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-04 22:53:39 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-04 22:53:39 -0700
commitda5aad2ecc57ce268b3f8421ac5e1cd759982c66 (patch)
tree2c059eeafc94a0e8a8c003ba0992b0dd97608a4f
parentee2b072ada7e2e8741609d962dc052ad2283fd90 (diff)
parentbbb644a204ca3ebca09dce03aded646033428664 (diff)
Merge bk://kernel.bkbits.net/davem/sparc-2.6
into ppc970.osdl.org:/home/torvalds/v2.6/linux
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c4
-rw-r--r--arch/sparc64/math-emu/sfp-util.h180
-rw-r--r--fs/aio.c18
-rw-r--r--fs/compat_ioctl.c21
-rw-r--r--include/linux/aio.h7
-rw-r--r--init/main.c6
-rw-r--r--kernel/compat.c63
7 files changed, 165 insertions, 134 deletions
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index c1c06402187d..0ed11eaec00f 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -800,8 +800,8 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
}
/* So stupid... */
-extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int,
- struct compat_rusage *);
+extern long compat_sys_wait4(compat_pid_t, compat_uint_t __user *, int,
+ struct compat_rusage __user *);
asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru)
{
diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc64/math-emu/sfp-util.h
index bdde3da0f3be..31e474738cf6 100644
--- a/arch/sparc64/math-emu/sfp-util.h
+++ b/arch/sparc64/math-emu/sfp-util.h
@@ -11,106 +11,106 @@
#include <linux/types.h>
#include <asm/byteorder.h>
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addcc %4,%5,%1\n\
- add %2,%3,%0\n\
- bcs,a,pn %%xcc, 1f\n\
- add %0, 1, %0\n\
- 1:" \
- : "=r" ((UDItype)(sh)), \
- "=&r" ((UDItype)(sl)) \
- : "r" ((UDItype)(ah)), \
- "r" ((UDItype)(bh)), \
- "r" ((UDItype)(al)), \
- "r" ((UDItype)(bl)) \
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addcc %4,%5,%1\n\t" \
+ "add %2,%3,%0\n\t" \
+ "bcs,a,pn %%xcc, 1f\n\t" \
+ "add %0, 1, %0\n" \
+ "1:" \
+ : "=r" ((UDItype)(sh)), \
+ "=&r" ((UDItype)(sl)) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), \
+ "r" ((UDItype)(bl)) \
: "cc")
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subcc %4,%5,%1\n\
- sub %2,%3,%0\n\
- bcs,a,pn %%xcc, 1f\n\
- sub %0, 1, %0\n\
- 1:" \
- : "=r" ((UDItype)(sh)), \
- "=&r" ((UDItype)(sl)) \
- : "r" ((UDItype)(ah)), \
- "r" ((UDItype)(bh)), \
- "r" ((UDItype)(al)), \
- "r" ((UDItype)(bl)) \
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subcc %4,%5,%1\n\t" \
+ "sub %2,%3,%0\n\t" \
+ "bcs,a,pn %%xcc, 1f\n\t" \
+ "sub %0, 1, %0\n" \
+ "1:" \
+ : "=r" ((UDItype)(sh)), \
+ "=&r" ((UDItype)(sl)) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), \
+ "r" ((UDItype)(bl)) \
: "cc")
-#define umul_ppmm(wh, wl, u, v) \
- do { \
- UDItype tmp1, tmp2, tmp3, tmp4; \
- __asm__ __volatile__ ( \
- "srl %7,0,%3\n\
- mulx %3,%6,%1\n\
- srlx %6,32,%2\n\
- mulx %2,%3,%4\n\
- sllx %4,32,%5\n\
- srl %6,0,%3\n\
- sub %1,%5,%5\n\
- srlx %5,32,%5\n\
- addcc %4,%5,%4\n\
- srlx %7,32,%5\n\
- mulx %3,%5,%3\n\
- mulx %2,%5,%5\n\
- sethi %%hi(0x80000000),%2\n\
- addcc %4,%3,%4\n\
- srlx %4,32,%4\n\
- add %2,%2,%2\n\
- movcc %%xcc,%%g0,%2\n\
- addcc %5,%4,%5\n\
- sllx %3,32,%3\n\
- add %1,%3,%1\n\
- add %5,%2,%0" \
- : "=r" ((UDItype)(wh)), \
- "=&r" ((UDItype)(wl)), \
- "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
- : "r" ((UDItype)(u)), \
- "r" ((UDItype)(v)) \
- : "cc"); \
+#define umul_ppmm(wh, wl, u, v) \
+ do { \
+ UDItype tmp1, tmp2, tmp3, tmp4; \
+ __asm__ __volatile__ ( \
+ "srl %7,0,%3\n\t" \
+ "mulx %3,%6,%1\n\t" \
+ "srlx %6,32,%2\n\t" \
+ "mulx %2,%3,%4\n\t" \
+ "sllx %4,32,%5\n\t" \
+ "srl %6,0,%3\n\t" \
+ "sub %1,%5,%5\n\t" \
+ "srlx %5,32,%5\n\t" \
+ "addcc %4,%5,%4\n\t" \
+ "srlx %7,32,%5\n\t" \
+ "mulx %3,%5,%3\n\t" \
+ "mulx %2,%5,%5\n\t" \
+ "sethi %%hi(0x80000000),%2\n\t" \
+ "addcc %4,%3,%4\n\t" \
+ "srlx %4,32,%4\n\t" \
+ "add %2,%2,%2\n\t" \
+ "movcc %%xcc,%%g0,%2\n\t" \
+ "addcc %5,%4,%5\n\t" \
+ "sllx %3,32,%3\n\t" \
+ "add %1,%3,%1\n\t" \
+ "add %5,%2,%0" \
+ : "=r" ((UDItype)(wh)), \
+ "=&r" ((UDItype)(wl)), \
+ "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
+ : "r" ((UDItype)(u)), \
+ "r" ((UDItype)(v)) \
+ : "cc"); \
} while (0)
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { \
- UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \
- __d1 = (d >> 32); \
- __d0 = (USItype)d; \
- \
- __r1 = (n1) % __d1; \
- __q1 = (n1) / __d1; \
- __m = (UWtype) __q1 * __d0; \
- __r1 = (__r1 << 32) | (n0 >> 32); \
- if (__r1 < __m) \
- { \
- __q1--, __r1 += (d); \
- if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \
- if (__r1 < __m) \
- __q1--, __r1 += (d); \
- } \
- __r1 -= __m; \
- \
- __r0 = __r1 % __d1; \
- __q0 = __r1 / __d1; \
- __m = (UWtype) __q0 * __d0; \
- __r0 = (__r0 << 32) | ((USItype)n0); \
- if (__r0 < __m) \
- { \
- __q0--, __r0 += (d); \
- if (__r0 >= (d)) \
- if (__r0 < __m) \
- __q0--, __r0 += (d); \
- } \
- __r0 -= __m; \
- \
- (q) = (UWtype) (__q1 << 32) | __q0; \
- (r) = __r0; \
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \
+ __d1 = (d >> 32); \
+ __d0 = (USItype)d; \
+ \
+ __r1 = (n1) % __d1; \
+ __q1 = (n1) / __d1; \
+ __m = (UWtype) __q1 * __d0; \
+ __r1 = (__r1 << 32) | (n0 >> 32); \
+ if (__r1 < __m) \
+ { \
+ __q1--, __r1 += (d); \
+ if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \
+ if (__r1 < __m) \
+ __q1--, __r1 += (d); \
+ } \
+ __r1 -= __m; \
+ \
+ __r0 = __r1 % __d1; \
+ __q0 = __r1 / __d1; \
+ __m = (UWtype) __q0 * __d0; \
+ __r0 = (__r0 << 32) | ((USItype)n0); \
+ if (__r0 < __m) \
+ { \
+ __q0--, __r0 += (d); \
+ if (__r0 >= (d)) \
+ if (__r0 < __m) \
+ __q0--, __r0 += (d); \
+ } \
+ __r0 -= __m; \
+ \
+ (q) = (UWtype) (__q1 << 32) | __q0; \
+ (r) = __r0; \
} while (0)
#define UDIV_NEEDS_NORMALIZATION 1
-#define abort() \
+#define abort() \
return 0
#ifdef __BIG_ENDIAN
diff --git a/fs/aio.c b/fs/aio.c
index 597648e214a7..ed984b58fe7d 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -394,7 +394,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx)
req->ki_ctx = ctx;
req->ki_cancel = NULL;
req->ki_retry = NULL;
- req->ki_user_obj = NULL;
+ req->ki_obj.user = NULL;
/* Check if the completion queue has enough free space to
* accept an event from this io.
@@ -437,7 +437,7 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
{
req->ki_ctx = NULL;
req->ki_filp = NULL;
- req->ki_user_obj = NULL;
+ req->ki_obj.user = NULL;
kmem_cache_free(kiocb_cachep, req);
ctx->reqs_active--;
@@ -605,7 +605,7 @@ void fastcall kick_iocb(struct kiocb *iocb)
* single context. */
if (is_sync_kiocb(iocb)) {
kiocbSetKicked(iocb);
- wake_up_process(iocb->ki_user_obj);
+ wake_up_process(iocb->ki_obj.tsk);
return;
}
@@ -653,7 +653,7 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
spin_unlock_irq(&ctx->ctx_lock);
}
/* sync iocbs put the task here for us */
- wake_up_process(iocb->ki_user_obj);
+ wake_up_process(iocb->ki_obj.tsk);
return ret;
}
@@ -673,13 +673,13 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
event = aio_ring_event(info, tail, KM_IRQ0);
tail = (tail + 1) % info->nr;
- event->obj = (u64)(unsigned long)iocb->ki_user_obj;
+ event->obj = (u64)(unsigned long)iocb->ki_obj.user;
event->data = iocb->ki_user_data;
event->res = res;
event->res2 = res2;
dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n",
- ctx, tail, iocb, iocb->ki_user_obj, iocb->ki_user_data,
+ ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
res, res2);
/* after flagging the request as done, we
@@ -1022,7 +1022,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
goto out_put_req;
}
- req->ki_user_obj = user_iocb;
+ req->ki_obj.user = user_iocb;
req->ki_user_data = iocb->aio_data;
req->ki_pos = iocb->aio_offset;
@@ -1148,7 +1148,7 @@ struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, u32 key
/* TODO: use a hash or array, this sucks. */
list_for_each(pos, &ctx->active_reqs) {
struct kiocb *kiocb = list_kiocb(pos);
- if (kiocb->ki_user_obj == iocb && kiocb->ki_key == key)
+ if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key)
return kiocb;
}
return NULL;
@@ -1195,7 +1195,7 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
struct io_event tmp;
pr_debug("calling cancel\n");
memset(&tmp, 0, sizeof(tmp));
- tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj;
+ tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user;
tmp.data = kiocb->ki_user_data;
ret = cancel(kiocb, &tmp);
if (!ret) {
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c14b9cd979d6..fc3fb9f1414f 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -218,9 +218,14 @@ static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
{
u32 tmp;
- if(get_user(tmp, &up->base))
+ if (get_user(tmp, &up->base))
return -EFAULT;
- kp->base = compat_ptr(tmp);
+
+ /* This is actually a physical address stored
+ * as a void pointer.
+ */
+ kp->base = (void *)(unsigned long) tmp;
+
__get_user(kp->height, &up->height);
__get_user(kp->width, &up->width);
__get_user(kp->depth, &up->depth);
@@ -3107,7 +3112,8 @@ static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long
set_fs(old_fs);
if (!err)
- err = put_user(kuid, (unsigned int *)compat_ptr(arg));
+ err = put_user(kuid,
+ (unsigned int __user *) compat_ptr(arg));
return err;
}
@@ -3187,7 +3193,8 @@ static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long
static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg);
- struct ncp_privatedata_ioctl *p = __user compat_alloc_user_space(sizeof(*p));
+ struct ncp_privatedata_ioctl __user *p =
+ compat_alloc_user_space(sizeof(*p));
u32 len;
int err;
@@ -3209,8 +3216,10 @@ static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
{
- struct ncp_privatedata_ioctl_32 n32, *p32 = compat_ptr(arg);
- struct ncp_privatedata_ioctl *p = compat_alloc_user_space(sizeof(*p));
+ struct ncp_privatedata_ioctl_32 n32;
+ struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg);
+ struct ncp_privatedata_ioctl __user *p =
+ compat_alloc_user_space(sizeof(*p));
if (copy_from_user(&n32, p32, sizeof(n32)) ||
put_user(n32.len, &p->len) ||
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 6e88c87c901e..93fe78800740 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -59,7 +59,10 @@ struct kiocb {
struct list_head ki_list; /* the aio core uses this
* for cancellation */
- void __user *ki_user_obj; /* pointer to userland's iocb */
+ union {
+ void __user *user;
+ struct task_struct *tsk;
+ } ki_obj;
__u64 ki_user_data; /* user's data for completion */
loff_t ki_pos;
@@ -76,7 +79,7 @@ struct kiocb {
(x)->ki_filp = (filp); \
(x)->ki_ctx = &tsk->active_mm->default_kioctx; \
(x)->ki_cancel = NULL; \
- (x)->ki_user_obj = tsk; \
+ (x)->ki_obj.tsk = tsk; \
} while (0)
#define AIO_RING_MAGIC 0xa10a10a1
diff --git a/init/main.c b/init/main.c
index 076a65f90fbd..613aaaba89f8 100644
--- a/init/main.c
+++ b/init/main.c
@@ -186,7 +186,7 @@ void __devinit calibrate_delay(void)
loops_per_jiffy = (1<<12);
printk("Calibrating delay loop... ");
- while (loops_per_jiffy <<= 1) {
+ while ((loops_per_jiffy <<= 1) != 0) {
/* wait for "start of" clock tick */
ticks = jiffies;
while (ticks == jiffies)
@@ -632,7 +632,7 @@ static int init(void * unused)
* check if there is an early userspace init. If yes, let it do all
* the work
*/
- if (sys_access("/init", 0) == 0)
+ if (sys_access((const char __user *) "/init", 0) == 0)
execute_command = "/init";
else
prepare_namespace();
@@ -646,7 +646,7 @@ static int init(void * unused)
unlock_kernel();
system_state = SYSTEM_RUNNING;
- if (sys_open("/dev/console", O_RDWR, 0) < 0)
+ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n");
(void) sys_dup(0);
diff --git a/kernel/compat.c b/kernel/compat.c
index 540574ce88b5..57cc48e90361 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -182,7 +182,7 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_sigpending(&s);
+ ret = sys_sigpending((old_sigset_t __user *) &s);
set_fs(old_fs);
if (ret == 0)
ret = put_user(s, set);
@@ -200,7 +200,9 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL);
+ ret = sys_sigprocmask(how,
+ set ? (old_sigset_t __user *) &s : NULL,
+ oset ? (old_sigset_t __user *) &s : NULL);
set_fs(old_fs);
if (ret == 0)
if (oset)
@@ -223,7 +225,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val,
timeout = timespec_to_jiffies(&t) + 1;
}
if (op >= FUTEX_REQUEUE)
- val2 = (int) (long) utime;
+ val2 = (int) (unsigned long) utime;
return do_futex((unsigned long)uaddr, op, val, timeout,
(unsigned long)uaddr2, val2, val3);
@@ -250,7 +252,7 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
if (r.rlim_max == COMPAT_RLIM_INFINITY)
r.rlim_max = RLIM_INFINITY;
set_fs(KERNEL_DS);
- ret = sys_setrlimit(resource, &r);
+ ret = sys_setrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs);
return ret;
}
@@ -292,7 +294,7 @@ asmlinkage long compat_sys_getrlimit (unsigned int resource,
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_getrlimit(resource, &r);
+ ret = sys_getrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs);
if (!ret) {
if (r.rlim_cur > COMPAT_RLIM_INFINITY)
@@ -340,7 +342,7 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_getrusage(who, &r);
+ ret = sys_getrusage(who, (struct rusage __user *) &r);
set_fs(old_fs);
if (ret)
@@ -365,7 +367,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
mm_segment_t old_fs = get_fs();
set_fs (KERNEL_DS);
- ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r);
+ ret = sys_wait4(pid,
+ (stat_addr ?
+ (unsigned int __user *) &status : NULL),
+ options, (struct rusage __user *) &r);
set_fs (old_fs);
if (ret > 0) {
@@ -382,18 +387,18 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
unsigned int len,
compat_ulong_t __user *user_mask_ptr)
{
- unsigned long kernel_mask;
+ unsigned long kern_mask;
mm_segment_t old_fs;
int ret;
- if (get_user(kernel_mask, user_mask_ptr))
+ if (get_user(kern_mask, user_mask_ptr))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid,
- sizeof(kernel_mask),
- &kernel_mask);
+ sizeof(kern_mask),
+ (unsigned long __user *) &kern_mask);
set_fs(old_fs);
return ret;
@@ -402,20 +407,20 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t __user *user_mask_ptr)
{
- unsigned long kernel_mask;
+ unsigned long kern_mask;
mm_segment_t old_fs;
int ret;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid,
- sizeof(kernel_mask),
- &kernel_mask);
+ sizeof(kern_mask),
+ (unsigned long __user *) &kern_mask);
set_fs(old_fs);
if (ret > 0) {
ret = sizeof(compat_ulong_t);
- if (put_user(kernel_mask, user_mask_ptr))
+ if (put_user(kern_mask, user_mask_ptr))
return -EFAULT;
}
@@ -454,7 +459,9 @@ long compat_timer_settime(timer_t timer_id, int flags,
return -EFAULT;
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_timer_settime(timer_id, flags, &newts, &oldts);
+ err = sys_timer_settime(timer_id, flags,
+ (struct itimerspec __user *) &newts,
+ (struct itimerspec __user *) &oldts);
set_fs(oldfs);
if (!err && old && put_compat_itimerspec(old, &oldts))
return -EFAULT;
@@ -467,9 +474,11 @@ long compat_timer_gettime(timer_t timer_id,
long err;
mm_segment_t oldfs;
struct itimerspec ts;
+
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_timer_gettime(timer_id, &ts);
+ err = sys_timer_gettime(timer_id,
+ (struct itimerspec __user *) &ts);
set_fs(oldfs);
if (!err && put_compat_itimerspec(setting, &ts))
return -EFAULT;
@@ -482,11 +491,13 @@ long compat_clock_settime(clockid_t which_clock,
long err;
mm_segment_t oldfs;
struct timespec ts;
+
if (get_compat_timespec(&ts, tp))
return -EFAULT;
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_clock_settime(which_clock, &ts);
+ err = sys_clock_settime(which_clock,
+ (struct timespec __user *) &ts);
set_fs(oldfs);
return err;
}
@@ -497,9 +508,11 @@ long compat_clock_gettime(clockid_t which_clock,
long err;
mm_segment_t oldfs;
struct timespec ts;
+
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_clock_gettime(which_clock, &ts);
+ err = sys_clock_gettime(which_clock,
+ (struct timespec __user *) &ts);
set_fs(oldfs);
if (!err && put_compat_timespec(&ts, tp))
return -EFAULT;
@@ -512,9 +525,11 @@ long compat_clock_getres(clockid_t which_clock,
long err;
mm_segment_t oldfs;
struct timespec ts;
+
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = sys_clock_getres(which_clock, &ts);
+ err = sys_clock_getres(which_clock,
+ (struct timespec __user *) &ts);
set_fs(oldfs);
if (!err && put_compat_timespec(&ts, tp))
return -EFAULT;
@@ -528,11 +543,15 @@ long compat_clock_nanosleep(clockid_t which_clock, int flags,
long err;
mm_segment_t oldfs;
struct timespec in, out;
+
if (get_compat_timespec(&in, rqtp))
return -EFAULT;
+
oldfs = get_fs();
- set_fs(KERNEL_DS);
- err = sys_clock_nanosleep(which_clock, flags, &in, &out);
+ set_fs(KERNEL_DS);
+ err = sys_clock_nanosleep(which_clock, flags,
+ (struct timespec __user *) &in,
+ (struct timespec __user *) &out);
set_fs(oldfs);
if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
put_compat_timespec(&out, rmtp))