Commit b8719c31 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] uml: more __user annotations

From: Al Viro <viro@zeniv.linux.org.uk>

uml __user 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 ca34fb1a
...@@ -99,11 +99,12 @@ long sys_ipc (uint call, int first, int second, ...@@ -99,11 +99,12 @@ long sys_ipc (uint call, int first, int second,
switch (call) { switch (call) {
case SEMOP: case SEMOP:
return sys_semtimedop(first, (struct sembuf *) ptr, second, return sys_semtimedop(first, (struct sembuf __user *) ptr,
NULL); second, NULL);
case SEMTIMEDOP: case SEMTIMEDOP:
return sys_semtimedop(first, (struct sembuf *) ptr, second, return sys_semtimedop(first, (struct sembuf __user *) ptr,
(const struct timespec *) fifth); second,
(const struct timespec __user *) fifth);
case SEMGET: case SEMGET:
return sys_semget (first, second, third); return sys_semget (first, second, third);
case SEMCTL: { case SEMCTL: {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,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)
{ {
int err = 0; int err = 0;
...@@ -54,7 +54,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, ...@@ -54,7 +54,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
return(err); return(err);
} }
int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, int copy_sc_to_user_skas(struct sigcontext __user *to,
struct _fpstate __user *to_fp,
struct pt_regs *regs, unsigned long mask, struct pt_regs *regs, unsigned long mask,
unsigned long sp) unsigned long sp)
{ {
...@@ -106,10 +107,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, ...@@ -106,10 +107,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
#endif #endif
#ifdef CONFIG_MODE_TT #ifdef CONFIG_MODE_TT
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;
...@@ -124,13 +126,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, ...@@ -124,13 +126,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 __user *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));
/* The SP in the sigcontext is the updated one for the signal /* The SP in the sigcontext is the updated one for the signal
...@@ -158,7 +161,8 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) ...@@ -158,7 +161,8 @@ 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 __user *to,
struct _fpstate __user *fp,
struct pt_regs *from, unsigned long mask, struct pt_regs *from, unsigned long mask,
unsigned long sp) unsigned long sp)
{ {
...@@ -169,7 +173,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, ...@@ -169,7 +173,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
struct rt_sigframe struct rt_sigframe
{ {
char *pretcode; char __user *pretcode;
struct ucontext uc; struct ucontext uc;
struct siginfo info; struct siginfo info;
}; };
...@@ -188,7 +192,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, ...@@ -188,7 +192,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
frame = (struct rt_sigframe __user *) frame = (struct rt_sigframe __user *)
round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
frame = (struct rt_sigframe *) ((unsigned long) frame - 128); frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128);
if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
goto out; goto out;
......
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
#define __get_user(x, ptr) \ #define __get_user(x, ptr) \
({ \ ({ \
const __typeof__(ptr) __private_ptr = ptr; \ const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \
__typeof__(x) __private_val; \ __typeof__(x) __private_val; \
int __private_ret = -EFAULT; \ int __private_ret = -EFAULT; \
(x) = (__typeof__(*(__private_ptr)))0; \ (x) = (__typeof__(*(__private_ptr)))0; \
if (__copy_from_user((void *) &__private_val, (__private_ptr), \ if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\
sizeof(*(__private_ptr))) == 0) { \ sizeof(*(__private_ptr))) == 0) { \
(x) = (__typeof__(*(__private_ptr))) __private_val; \ (x) = (__typeof__(*(__private_ptr))) __private_val; \
__private_ret = 0; \ __private_ret = 0; \
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#define __put_user(x, ptr) \ #define __put_user(x, ptr) \
({ \ ({ \
__typeof__(ptr) __private_ptr = ptr; \ __typeof__(*(ptr)) __user *__private_ptr = ptr; \
__typeof__(*(__private_ptr)) __private_val; \ __typeof__(*(__private_ptr)) __private_val; \
int __private_ret = -EFAULT; \ int __private_ret = -EFAULT; \
__private_val = (__typeof__(*(__private_ptr))) (x); \ __private_val = (__typeof__(*(__private_ptr))) (x); \
......
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