Commit d50e8cc1 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] annotations for arch/ppc and include/asm-ppc

Usual set - explicit -D<arch>=1 for sparse, __sighandler_t / __sigrestore_t
annotated, annotations in arch/ppc/kernel/*, etc. - same as for other platforms
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8450b99a
......@@ -27,6 +27,8 @@ cflags-y += -Iarch/$(ARCH) -msoft-float -pipe \
-ffixed-r2 -Wno-uninitialized -mmultiple
CPP = $(CC) -E $(CFLAGS)
CHECK := $(CHECK) -D__powerpc__=1
ifndef CONFIG_E500
cflags-y += -mstring
endif
......
......@@ -448,15 +448,15 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
}
if (!write && !first && left) {
if(put_user('\n', (char *) buffer))
if(put_user('\n', (char __user *) buffer))
return -EFAULT;
left--, buffer++;
}
if (write) {
p = (char *) buffer;
char __user *s = (char __user *) buffer;
while (left) {
char c;
if(get_user(c, p++))
if(get_user(c, s++))
return -EFAULT;
if (!isspace(c))
break;
......
......@@ -544,7 +544,7 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
#endif
else
val = __unpack_fe01(tsk->thread.fpexc_mode);
return put_user(val, (unsigned int *) adr);
return put_user(val, (unsigned int __user *) adr);
}
int sys_clone(unsigned long clone_flags, unsigned long usp,
......
......@@ -77,7 +77,7 @@ static inline int put_reg(struct task_struct *task, int regno,
/*
* Get contents of AltiVec register state in task TASK
*/
static inline int get_vrregs(unsigned long *data, struct task_struct *task)
static inline int get_vrregs(unsigned long __user *data, struct task_struct *task)
{
int i, j;
......@@ -105,7 +105,7 @@ static inline int get_vrregs(unsigned long *data, struct task_struct *task)
/*
* Write contents of AltiVec register state into task TASK.
*/
static inline int set_vrregs(struct task_struct *task, unsigned long *data)
static inline int set_vrregs(struct task_struct *task, unsigned long __user *data)
{
int i, j;
......@@ -286,7 +286,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
if (copied != sizeof(tmp))
break;
ret = put_user(tmp,(unsigned long *) data);
ret = put_user(tmp,(unsigned long __user *) data);
break;
}
......@@ -312,7 +312,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
preempt_enable();
tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
}
ret = put_user(tmp,(unsigned long *) data);
ret = put_user(tmp,(unsigned long __user *) data);
break;
}
......@@ -410,7 +410,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
if (child->thread.regs->msr & MSR_VEC)
giveup_altivec(child);
preempt_enable();
ret = get_vrregs((unsigned long *)data, child);
ret = get_vrregs((unsigned long __user *)data, child);
break;
case PTRACE_SETVRREGS:
......@@ -421,7 +421,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
if (child->thread.regs->msr & MSR_VEC)
giveup_altivec(child);
preempt_enable();
ret = set_vrregs(child, (unsigned long *)data);
ret = set_vrregs(child, (unsigned long __user *)data);
break;
#endif
#ifdef CONFIG_SPE
......@@ -429,7 +429,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
/* Get the child spe register state. */
if (child->thread.regs->msr & MSR_SPE)
giveup_spe(child);
ret = get_evrregs((unsigned long *)data, child);
ret = get_evrregs((unsigned long __user *)data, child);
break;
case PTRACE_SETEVRREGS:
......@@ -438,7 +438,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
* of register state from memory */
if (child->thread.regs->msr & MSR_SPE)
giveup_spe(child);
ret = set_evrregs(child, (unsigned long *)data);
ret = set_evrregs(child, (unsigned long __user *)data);
break;
#endif
......
......@@ -187,7 +187,7 @@ struct rt_sigframe
* altivec/spe instructions at some point.
*/
static int
save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret)
save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, int sigret)
{
/* save general and floating-point registers */
CHECK_FULL_REGS(regs);
......@@ -229,7 +229,7 @@ save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret)
* significant bits of a vector, we "cheat" and stuff VRSAVE in the
* most significant bits of that same vector. --BenH
*/
if (__put_user(current->thread.vrsave, (u32 *)&frame->mc_vregs[32]))
if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32]))
return 1;
#endif /* CONFIG_ALTIVEC */
......@@ -308,7 +308,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig)
memset(&current->thread.vr, 0, ELF_NVRREG * sizeof(vector128));
/* Always get VRSAVE back */
if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
return 1;
#endif /* CONFIG_ALTIVEC */
......@@ -412,7 +412,7 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int sig)
{
sigset_t set;
struct mcontext *mcp;
struct mcontext __user *mcp;
if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))
|| __get_user(mcp, &ucp->uc_regs))
......@@ -447,8 +447,8 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
if (new_ctx == NULL)
return 0;
if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
|| __get_user(tmp, (u8 *) new_ctx)
|| __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
|| __get_user(tmp, (u8 __user *) new_ctx)
|| __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
return -EFAULT;
/*
......@@ -524,7 +524,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
/* create a stack frame for the caller of the handler */
newsp -= __SIGNAL_FRAMESIZE;
if (verify_area(VERIFY_WRITE, (void *) newsp, origsp - newsp))
if (verify_area(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
goto badframe;
#if _NSIG != 64
......@@ -583,7 +583,7 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
set.sig[1] = sigctx._unused[3];
restore_sigmask(&set);
sr = (struct mcontext *) sigctx.regs;
sr = (struct mcontext __user *) sigctx.regs;
if (verify_area(VERIFY_READ, sr, sizeof(*sr))
|| restore_user_regs(regs, sr, 1))
goto badframe;
......
......@@ -67,7 +67,7 @@ sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fif
break;
case SEMTIMEDOP:
ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
second, (const struct timespec *) fifth);
second, (const struct timespec __user *) fifth);
break;
case SEMGET:
ret = sys_semget (first, second, third);
......@@ -208,17 +208,17 @@ unsigned long sys_mmap(unsigned long addr, size_t len,
* sys_select() with the appropriate args. -- Cort
*/
int
ppc_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp)
ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
{
if ( (unsigned long)n >= 4096 )
{
unsigned long __user *buffer = (unsigned long __user *)n;
if (verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long))
|| __get_user(n, buffer)
|| __get_user(inp, ((fd_set **)(buffer+1)))
|| __get_user(outp, ((fd_set **)(buffer+2)))
|| __get_user(exp, ((fd_set **)(buffer+3)))
|| __get_user(tvp, ((struct timeval **)(buffer+4))))
|| __get_user(inp, ((fd_set __user * __user *)(buffer+1)))
|| __get_user(outp, ((fd_set __user * __user *)(buffer+2)))
|| __get_user(exp, ((fd_set __user * __user *)(buffer+3)))
|| __get_user(tvp, ((struct timeval __user * __user *)(buffer+4))))
return -EFAULT;
}
return sys_select(n, inp, outp, exp, tvp);
......
......@@ -114,7 +114,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
info.si_signo = signr;
info.si_errno = 0;
info.si_code = code;
info.si_addr = (void *) addr;
info.si_addr = (void __user *) addr;
force_sig_info(signr, &info, current);
}
......
......@@ -262,7 +262,7 @@ int emulate_altivec(struct pt_regs *regs)
unsigned int va, vb, vc, vd;
vector128 *vrs;
if (get_user(instr, (unsigned int *) regs->nip))
if (get_user(instr, (unsigned int __user *) regs->nip))
return -EFAULT;
if ((instr >> 26) != 4)
return -EINVAL; /* not an altivec instruction */
......
......@@ -59,7 +59,7 @@ static int store_updates_sp(struct pt_regs *regs)
{
unsigned int inst;
if (get_user(inst, (unsigned int *)regs->nip))
if (get_user(inst, (unsigned int __user *)regs->nip))
return 0;
/* check for 1 in the rA field */
if (((inst >> 16) & 0x1f) != 1)
......@@ -281,7 +281,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = code;
info.si_addr = (void *) address;
info.si_addr = (void __user *) address;
force_sig_info(SIGSEGV, &info, current);
return 0;
}
......@@ -309,7 +309,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
info.si_signo = SIGBUS;
info.si_errno = 0;
info.si_code = BUS_ADRERR;
info.si_addr = (void *)address;
info.si_addr = (void __user *)address;
force_sig_info (SIGBUS, &info, current);
if (!user_mode(regs))
return SIGBUS;
......
......@@ -118,7 +118,11 @@ typedef struct {
#define SIG_SETMASK 2 /* for setting the signal mask */
/* Type of a signal handler. */
typedef void (*__sighandler_t)(int);
typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t;
typedef void __restorefn_t(void);
typedef __restorefn_t __user *__sigrestore_t;
#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
......@@ -128,13 +132,13 @@ struct old_sigaction {
__sighandler_t sa_handler;
old_sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
__sigrestore_t sa_restorer;
};
struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
void (*sa_restorer)(void);
__sigrestore_t sa_restorer;
sigset_t sa_mask; /* mask last for extensibility */
};
......@@ -143,7 +147,7 @@ struct k_sigaction {
};
typedef struct sigaltstack {
void *ss_sp;
void __user *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t;
......
......@@ -13,10 +13,10 @@ struct mcontext {
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
struct ucontext __user *uc_link;
stack_t uc_stack;
int uc_pad[7];
struct mcontext *uc_regs; /* points to uc_mcontext field */
struct mcontext __user *uc_regs;/* points to uc_mcontext field */
sigset_t uc_sigmask;
/* glibc has 1024-bit signal masks, ours are 64-bit */
int uc_maskext[30];
......
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