Commit 7f93f6dd authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] Sparse annotations and cleanup warnings for PA-RISC

 - Missing UL on large integers
 - 0/NULL confusion
 - __user annotations
 - C99-style array elements
Signed-off-by: default avatarRandolph Chung <tausq@parisc-linux.org>
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b6181a0a
...@@ -120,10 +120,10 @@ static unsigned long f_extend(unsigned long address) ...@@ -120,10 +120,10 @@ static unsigned long f_extend(unsigned long address)
#ifdef __LP64__ #ifdef __LP64__
if(unlikely(parisc_narrow_firmware)) { if(unlikely(parisc_narrow_firmware)) {
if((address & 0xff000000) == 0xf0000000) if((address & 0xff000000) == 0xf0000000)
return 0xf0f0f0f000000000 | (u32)address; return 0xf0f0f0f000000000UL | (u32)address;
if((address & 0xf0000000) == 0xf0000000) if((address & 0xf0000000) == 0xf0000000)
return 0xffffffff00000000 | (u32)address; return 0xffffffff00000000UL | (u32)address;
} }
#endif #endif
return address; return address;
...@@ -912,7 +912,7 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap) ...@@ -912,7 +912,7 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
* *
* Reset the system. * Reset the system.
*/ */
int pdc_do_reset() int pdc_do_reset(void)
{ {
int retval; int retval;
......
...@@ -1296,18 +1296,18 @@ static struct hp_cpu_type_mask { ...@@ -1296,18 +1296,18 @@ static struct hp_cpu_type_mask {
}; };
char *cpu_name_version[][2] = { char *cpu_name_version[][2] = {
[pcx] { "PA7000 (PCX)", "1.0" }, [pcx] = { "PA7000 (PCX)", "1.0" },
[pcxs] { "PA7000 (PCX-S)", "1.1a" }, [pcxs] = { "PA7000 (PCX-S)", "1.1a" },
[pcxt] { "PA7100 (PCX-T)", "1.1b" }, [pcxt] = { "PA7100 (PCX-T)", "1.1b" },
[pcxt_] { "PA7200 (PCX-T')", "1.1c" }, [pcxt_] = { "PA7200 (PCX-T')", "1.1c" },
[pcxl] { "PA7100LC (PCX-L)", "1.1d" }, [pcxl] = { "PA7100LC (PCX-L)", "1.1d" },
[pcxl2] { "PA7300LC (PCX-L2)", "1.1e" }, [pcxl2] = { "PA7300LC (PCX-L2)", "1.1e" },
[pcxu] { "PA8000 (PCX-U)", "2.0" }, [pcxu] = { "PA8000 (PCX-U)", "2.0" },
[pcxu_] { "PA8200 (PCX-U+)", "2.0" }, [pcxu_] = { "PA8200 (PCX-U+)", "2.0" },
[pcxw] { "PA8500 (PCX-W)", "2.0" }, [pcxw] = { "PA8500 (PCX-W)", "2.0" },
[pcxw_] { "PA8600 (PCX-W+)", "2.0" }, [pcxw_] = { "PA8600 (PCX-W+)", "2.0" },
[pcxw2] { "PA8700 (PCX-W2)", "2.0" }, [pcxw2] = { "PA8700 (PCX-W2)", "2.0" },
[mako] { "PA8800 (Mako)", "2.0" } [mako] = { "PA8800 (Mako)", "2.0" }
}; };
const char * __init const char * __init
......
...@@ -563,7 +563,7 @@ static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -563,7 +563,7 @@ static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
#endif #endif
#define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, 0 }, #define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL },
#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl) #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl)
#define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = { #define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
......
...@@ -157,16 +157,16 @@ static struct rdr_tbl_ent perf_rdr_tbl_U[] = { ...@@ -157,16 +157,16 @@ static struct rdr_tbl_ent perf_rdr_tbl_U[] = {
* this array. * this array.
*/ */
static uint64_t perf_bitmasks[] = { static uint64_t perf_bitmasks[] = {
0x0000000000000000, /* first dbl word must be zero */ 0x0000000000000000ul, /* first dbl word must be zero */
0xfdffe00000000000, /* RDR0 bitmask */ 0xfdffe00000000000ul, /* RDR0 bitmask */
0x003f000000000000, /* RDR1 bitmask */ 0x003f000000000000ul, /* RDR1 bitmask */
0x00ffffffffffffff, /* RDR20-RDR21 bitmask (152 bits) */ 0x00fffffffffffffful, /* RDR20-RDR21 bitmask (152 bits) */
0xffffffffffffffff, 0xfffffffffffffffful,
0xfffffffc00000000, 0xfffffffc00000000ul,
0xffffffffffffffff, /* RDR22-RDR23 bitmask (233 bits) */ 0xfffffffffffffffful, /* RDR22-RDR23 bitmask (233 bits) */
0xffffffffffffffff, 0xfffffffffffffffful,
0xfffffffffffffffc, 0xfffffffffffffffcul,
0xff00000000000000 0xff00000000000000ul
}; };
/* /*
...@@ -174,16 +174,16 @@ static uint64_t perf_bitmasks[] = { ...@@ -174,16 +174,16 @@ static uint64_t perf_bitmasks[] = {
* somethings have changed slightly. * somethings have changed slightly.
*/ */
static uint64_t perf_bitmasks_piranha[] = { static uint64_t perf_bitmasks_piranha[] = {
0x0000000000000000, /* first dbl word must be zero */ 0x0000000000000000ul, /* first dbl word must be zero */
0xfdffe00000000000, /* RDR0 bitmask */ 0xfdffe00000000000ul, /* RDR0 bitmask */
0x003f000000000000, /* RDR1 bitmask */ 0x003f000000000000ul, /* RDR1 bitmask */
0x00ffffffffffffff, /* RDR20-RDR21 bitmask (158 bits) */ 0x00fffffffffffffful, /* RDR20-RDR21 bitmask (158 bits) */
0xffffffffffffffff, 0xfffffffffffffffful,
0xfffffffc00000000, 0xfffffffc00000000ul,
0xffffffffffffffff, /* RDR22-RDR23 bitmask (210 bits) */ 0xfffffffffffffffful, /* RDR22-RDR23 bitmask (210 bits) */
0xffffffffffffffff, 0xfffffffffffffffful,
0xffffffffffffffff, 0xfffffffffffffffful,
0xfffc000000000000 0xfffc000000000000ul
}; };
static uint64_t *bitmask_array; /* array of bitmasks to use */ static uint64_t *bitmask_array; /* array of bitmasks to use */
...@@ -194,8 +194,8 @@ static uint64_t *bitmask_array; /* array of bitmasks to use */ ...@@ -194,8 +194,8 @@ static uint64_t *bitmask_array; /* array of bitmasks to use */
static int perf_config(uint32_t *image_ptr); static int perf_config(uint32_t *image_ptr);
static int perf_release(struct inode *inode, struct file *file); static int perf_release(struct inode *inode, struct file *file);
static int perf_open(struct inode *inode, struct file *file); static int perf_open(struct inode *inode, struct file *file);
static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos); static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos);
static ssize_t perf_write(struct file *file, const char *buf, size_t count, static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos); loff_t *ppos);
static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg); unsigned long arg);
...@@ -287,7 +287,7 @@ static int perf_release(struct inode *inode, struct file *file) ...@@ -287,7 +287,7 @@ static int perf_release(struct inode *inode, struct file *file)
/* /*
* Read does nothing for this driver * Read does nothing for this driver
*/ */
static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos)
{ {
return 0; return 0;
} }
...@@ -299,7 +299,7 @@ static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) ...@@ -299,7 +299,7 @@ static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos)
* called on the processor that the download should happen * called on the processor that the download should happen
* on. * on.
*/ */
static ssize_t perf_write(struct file *file, const char *buf, size_t count, static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
int err; int err;
...@@ -460,7 +460,7 @@ static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -460,7 +460,7 @@ static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
} }
/* copy out the Counters */ /* copy out the Counters */
if (copy_to_user((void *)arg, raddr, if (copy_to_user((void __user *)arg, raddr,
sizeof (raddr)) != 0) { sizeof (raddr)) != 0) {
return -EFAULT; return -EFAULT;
} }
...@@ -607,7 +607,7 @@ static int perf_stop_counters(uint32_t *raddr) ...@@ -607,7 +607,7 @@ static int perf_stop_counters(uint32_t *raddr)
* all of dword 22 and 58 bits (plus 6 don't care bits) of * all of dword 22 and 58 bits (plus 6 don't care bits) of
* dword 23. * dword 23.
*/ */
userbuf[21] &= 0xfffffffffffffc00; /* 0 to last 10 bits */ userbuf[21] &= 0xfffffffffffffc00ul; /* 0 to last 10 bits */
userbuf[22] = 0; userbuf[22] = 0;
userbuf[23] = 0; userbuf[23] = 0;
...@@ -802,8 +802,8 @@ static int perf_write_image(uint64_t *memaddr) ...@@ -802,8 +802,8 @@ static int perf_write_image(uint64_t *memaddr)
proc_hpa = cpu_device->hpa; proc_hpa = cpu_device->hpa;
/* Merge intrigue bits into Runway STATUS 0 */ /* Merge intrigue bits into Runway STATUS 0 */
tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecffffffffffff; tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecfffffffffffful;
__raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000), proc_hpa + RUNWAY_STATUS); __raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul), proc_hpa + RUNWAY_STATUS);
/* Write RUNWAY DEBUG registers */ /* Write RUNWAY DEBUG registers */
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
......
...@@ -251,7 +251,7 @@ int ...@@ -251,7 +251,7 @@ int
sys_clone(unsigned long clone_flags, unsigned long usp, sys_clone(unsigned long clone_flags, unsigned long usp,
struct pt_regs *regs) struct pt_regs *regs)
{ {
int *user_tid = (int *)regs->gr[26]; int __user *user_tid = (int __user *)regs->gr[26];
/* usp must be word aligned. This also prevents users from /* usp must be word aligned. This also prevents users from
* passing in the value 1 (which is the signal for a special * passing in the value 1 (which is the signal for a special
...@@ -357,12 +357,12 @@ asmlinkage int sys_execve(struct pt_regs *regs) ...@@ -357,12 +357,12 @@ asmlinkage int sys_execve(struct pt_regs *regs)
int error; int error;
char *filename; char *filename;
filename = getname((char *) regs->gr[26]); filename = getname((const char __user *) regs->gr[26]);
error = PTR_ERR(filename); error = PTR_ERR(filename);
if (IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
error = do_execve(filename, (char **) regs->gr[25], error = do_execve(filename, (char __user **) regs->gr[25],
(char **) regs->gr[24], regs); (char __user **) regs->gr[24], regs);
if (error == 0) { if (error == 0) {
task_lock(current); task_lock(current);
current->ptrace &= ~PT_DTRACE; current->ptrace &= ~PT_DTRACE;
......
...@@ -199,7 +199,7 @@ static void __init parisc_proc_mkdir(void) ...@@ -199,7 +199,7 @@ static void __init parisc_proc_mkdir(void)
case pcxl2: case pcxl2:
if (NULL == proc_gsc_root) if (NULL == proc_gsc_root)
{ {
proc_gsc_root = proc_mkdir("bus/gsc", 0); proc_gsc_root = proc_mkdir("bus/gsc", NULL);
} }
break; break;
case pcxt_: case pcxt_:
...@@ -210,13 +210,13 @@ static void __init parisc_proc_mkdir(void) ...@@ -210,13 +210,13 @@ static void __init parisc_proc_mkdir(void)
case pcxw2: case pcxw2:
if (NULL == proc_runway_root) if (NULL == proc_runway_root)
{ {
proc_runway_root = proc_mkdir("bus/runway", 0); proc_runway_root = proc_mkdir("bus/runway", NULL);
} }
break; break;
case mako: case mako:
if (NULL == proc_mckinley_root) if (NULL == proc_mckinley_root)
{ {
proc_mckinley_root = proc_mkdir("bus/mckinley", 0); proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
} }
break; break;
default: default:
......
...@@ -69,7 +69,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall); ...@@ -69,7 +69,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall);
#endif #endif
asmlinkage int asmlinkage int
sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs) sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
{ {
sigset_t saveset, newset; sigset_t saveset, newset;
#ifdef __LP64__ #ifdef __LP64__
...@@ -79,7 +79,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs) ...@@ -79,7 +79,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
/* XXX: Don't preclude handling different sized sigset_t's. */ /* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(compat_sigset_t)) if (sigsetsize != sizeof(compat_sigset_t))
return -EINVAL; return -EINVAL;
if (copy_from_user(&newset32, (compat_sigset_t *)unewset, sizeof(newset32))) if (copy_from_user(&newset32, (compat_sigset_t __user *)unewset, sizeof(newset32)))
return -EFAULT; return -EFAULT;
sigset_32to64(&newset,&newset32); sigset_32to64(&newset,&newset32);
...@@ -125,7 +125,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs) ...@@ -125,7 +125,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
#define INSN_DIE_HORRIBLY 0x68000ccc /* stw %r0,0x666(%sr0,%r0) */ #define INSN_DIE_HORRIBLY 0x68000ccc /* stw %r0,0x666(%sr0,%r0) */
static long static long
restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs) restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
{ {
long err = 0; long err = 0;
...@@ -143,14 +143,14 @@ restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs) ...@@ -143,14 +143,14 @@ restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs)
void void
sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
{ {
struct rt_sigframe *frame; struct rt_sigframe __user *frame;
struct siginfo si; struct siginfo si;
sigset_t set; sigset_t set;
unsigned long usp = (regs->gr[30] & ~(0x01UL)); unsigned long usp = (regs->gr[30] & ~(0x01UL));
unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE; unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
#ifdef __LP64__ #ifdef __LP64__
compat_sigset_t compat_set; compat_sigset_t compat_set;
struct compat_rt_sigframe * compat_frame; struct compat_rt_sigframe __user * compat_frame;
if(personality(current->personality) == PER_LINUX32) if(personality(current->personality) == PER_LINUX32)
sigframe_size = PARISC_RT_SIGFRAME_SIZE32; sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
...@@ -158,12 +158,12 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) ...@@ -158,12 +158,12 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
/* Unwind the user stack to get the rt_sigframe structure. */ /* Unwind the user stack to get the rt_sigframe structure. */
frame = (struct rt_sigframe *) frame = (struct rt_sigframe __user *)
(usp - sigframe_size); (usp - sigframe_size);
DBG(2,"sys_rt_sigreturn: frame is %p\n", frame); DBG(2,"sys_rt_sigreturn: frame is %p\n", frame);
#ifdef __LP64__ #ifdef __LP64__
compat_frame = (struct compat_rt_sigframe *)frame; compat_frame = (struct compat_rt_sigframe __user *)frame;
if(personality(current->personality) == PER_LINUX32){ if(personality(current->personality) == PER_LINUX32){
DBG(2,"sys_rt_sigreturn: ELF32 process.\n"); DBG(2,"sys_rt_sigreturn: ELF32 process.\n");
...@@ -238,7 +238,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) ...@@ -238,7 +238,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
* Set up a signal frame. * Set up a signal frame.
*/ */
static inline void * static inline void __user *
get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
{ {
/*FIXME: ELF32 vs. ELF64 has different frame_size, but since we /*FIXME: ELF32 vs. ELF64 has different frame_size, but since we
...@@ -251,11 +251,11 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) ...@@ -251,11 +251,11 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
sp = current->sas_ss_sp; /* Stacks grow up! */ sp = current->sas_ss_sp; /* Stacks grow up! */
DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp); DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp);
return (void *) sp; /* Stacks grow up. Fun. */ return (void __user *) sp; /* Stacks grow up. Fun. */
} }
static long static long
setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, int in_syscall) setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_syscall)
{ {
unsigned long flags = 0; unsigned long flags = 0;
...@@ -292,14 +292,14 @@ static long ...@@ -292,14 +292,14 @@ static long
setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs, int in_syscall) sigset_t *set, struct pt_regs *regs, int in_syscall)
{ {
struct rt_sigframe *frame; struct rt_sigframe __user *frame;
unsigned long rp, usp; unsigned long rp, usp;
unsigned long haddr, sigframe_size; unsigned long haddr, sigframe_size;
struct siginfo si; struct siginfo si;
int err = 0; int err = 0;
#ifdef __LP64__ #ifdef __LP64__
compat_int_t compat_val; compat_int_t compat_val;
struct compat_rt_sigframe * compat_frame; struct compat_rt_sigframe __user * compat_frame;
compat_sigset_t compat_set; compat_sigset_t compat_set;
#endif #endif
...@@ -313,7 +313,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -313,7 +313,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
#ifdef __LP64__ #ifdef __LP64__
compat_frame = (struct compat_rt_sigframe *)frame; compat_frame = (struct compat_rt_sigframe __user *)frame;
if(personality(current->personality) == PER_LINUX32) { if(personality(current->personality) == PER_LINUX32) {
DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
...@@ -396,7 +396,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -396,7 +396,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
#endif #endif
if (haddr & PA_PLABEL_FDESC) { if (haddr & PA_PLABEL_FDESC) {
Elf32_Fdesc fdesc; Elf32_Fdesc fdesc;
Elf32_Fdesc *ufdesc = (Elf32_Fdesc *)A(haddr & ~3); Elf32_Fdesc __user *ufdesc = (Elf32_Fdesc __user *)A(haddr & ~3);
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
...@@ -409,7 +409,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -409,7 +409,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
#ifdef __LP64__ #ifdef __LP64__
} else { } else {
Elf64_Fdesc fdesc; Elf64_Fdesc fdesc;
Elf64_Fdesc *ufdesc = (Elf64_Fdesc *)A(haddr & ~3); Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3);
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
......
...@@ -65,7 +65,7 @@ sigset_64to32(compat_sigset_t *s32, sigset_t *s64) ...@@ -65,7 +65,7 @@ sigset_64to32(compat_sigset_t *s32, sigset_t *s64)
} }
static int static int
put_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz) put_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
{ {
compat_sigset_t s; compat_sigset_t s;
...@@ -76,7 +76,7 @@ put_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz) ...@@ -76,7 +76,7 @@ put_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz)
} }
static int static int
get_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz) get_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
{ {
compat_sigset_t s; compat_sigset_t s;
int r; int r;
...@@ -90,7 +90,7 @@ get_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz) ...@@ -90,7 +90,7 @@ get_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz)
return r; return r;
} }
int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset,
unsigned int sigsetsize) unsigned int sigsetsize)
{ {
sigset_t old_set, new_set; sigset_t old_set, new_set;
...@@ -99,8 +99,8 @@ int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, ...@@ -99,8 +99,8 @@ int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset,
if (set && get_sigset32(set, &new_set, sigsetsize)) if (set && get_sigset32(set, &new_set, sigsetsize))
return -EFAULT; return -EFAULT;
KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? &new_set : NULL, KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? (sigset_t __user *)&new_set : NULL,
oset ? &old_set : NULL, sigsetsize); oset ? (sigset_t __user *)&old_set : NULL, sigsetsize);
if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize)) if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize))
return -EFAULT; return -EFAULT;
...@@ -109,12 +109,12 @@ int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, ...@@ -109,12 +109,12 @@ int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset,
} }
int sys32_rt_sigpending(compat_sigset_t *uset, unsigned int sigsetsize) int sys32_rt_sigpending(compat_sigset_t __user *uset, unsigned int sigsetsize)
{ {
int ret; int ret;
sigset_t set; sigset_t set;
KERNEL_SYSCALL(ret, sys_rt_sigpending, &set, sigsetsize); KERNEL_SYSCALL(ret, sys_rt_sigpending, (sigset_t __user *)&set, sigsetsize);
if (!ret && put_sigset32(uset, &set, sigsetsize)) if (!ret && put_sigset32(uset, &set, sigsetsize))
return -EFAULT; return -EFAULT;
...@@ -123,7 +123,7 @@ int sys32_rt_sigpending(compat_sigset_t *uset, unsigned int sigsetsize) ...@@ -123,7 +123,7 @@ int sys32_rt_sigpending(compat_sigset_t *uset, unsigned int sigsetsize)
} }
long long
sys32_rt_sigaction(int sig, const struct sigaction32 *act, struct sigaction32 *oact, sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigaction32 __user *oact,
size_t sigsetsize) size_t sigsetsize)
{ {
struct k_sigaction32 new_sa32, old_sa32; struct k_sigaction32 new_sa32, old_sa32;
...@@ -151,7 +151,7 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act, struct sigaction32 *o ...@@ -151,7 +151,7 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act, struct sigaction32 *o
} }
int int
do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned long sp) do_sigaltstack32 (const compat_stack_t __user *uss32, compat_stack_t __user *uoss32, unsigned long sp)
{ {
compat_stack_t ss32, oss32; compat_stack_t ss32, oss32;
stack_t ss, oss; stack_t ss, oss;
...@@ -162,7 +162,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned ...@@ -162,7 +162,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned
if (copy_from_user(&ss32, uss32, sizeof ss32)) if (copy_from_user(&ss32, uss32, sizeof ss32))
return -EFAULT; return -EFAULT;
ss.ss_sp = (void *)(unsigned long)ss32.ss_sp; ss.ss_sp = (void __user *)(unsigned long)ss32.ss_sp;
ss.ss_flags = ss32.ss_flags; ss.ss_flags = ss32.ss_flags;
ss.ss_size = ss32.ss_size; ss.ss_size = ss32.ss_size;
...@@ -172,7 +172,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned ...@@ -172,7 +172,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned
if (uoss32) if (uoss32)
ossp = &oss; ossp = &oss;
KERNEL_SYSCALL(ret, do_sigaltstack, ssp, ossp, sp); KERNEL_SYSCALL(ret, do_sigaltstack, (const stack_t __user *)ssp, (stack_t __user *)ossp, sp);
if (!ret && uoss32) { if (!ret && uoss32) {
oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp; oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp;
...@@ -186,7 +186,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned ...@@ -186,7 +186,7 @@ do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned
} }
long long
restore_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf, restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
struct pt_regs *regs) struct pt_regs *regs)
{ {
long err = 0; long err = 0;
...@@ -265,7 +265,7 @@ restore_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf, ...@@ -265,7 +265,7 @@ restore_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf,
* truncate for a 32-bit userspace. * truncate for a 32-bit userspace.
*/ */
long long
setup_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf, setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
struct pt_regs *regs, int in_syscall) struct pt_regs *regs, int in_syscall)
{ {
compat_int_t flags = 0; compat_int_t flags = 0;
......
...@@ -31,13 +31,13 @@ struct k_sigaction32 { ...@@ -31,13 +31,13 @@ struct k_sigaction32 {
void sigset_32to64(sigset_t *s64, compat_sigset_t *s32); void sigset_32to64(sigset_t *s64, compat_sigset_t *s32);
void sigset_64to32(compat_sigset_t *s32, sigset_t *s64); void sigset_64to32(compat_sigset_t *s32, sigset_t *s64);
int do_sigaltstack32 (const compat_stack_t *uss32, int do_sigaltstack32 (const compat_stack_t __user *uss32,
compat_stack_t *uoss32, unsigned long sp); compat_stack_t __user *uoss32, unsigned long sp);
long restore_sigcontext32(struct compat_sigcontext *sc, long restore_sigcontext32(struct compat_sigcontext __user *sc,
struct compat_regfile *rf, struct compat_regfile __user *rf,
struct pt_regs *regs); struct pt_regs *regs);
long setup_sigcontext32(struct compat_sigcontext *sc, long setup_sigcontext32(struct compat_sigcontext __user *sc,
struct compat_regfile *rf, struct compat_regfile __user *rf,
struct pt_regs *regs, int in_syscall); struct pt_regs *regs, int in_syscall);
#endif #endif
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
int sys_pipe(int *fildes) int sys_pipe(int __user *fildes)
{ {
int fd[2]; int fd[2];
int error; int error;
...@@ -161,7 +161,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, ...@@ -161,7 +161,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
} }
} }
long sys_shmat_wrapper(int shmid, char *shmaddr, int shmflag) long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
{ {
unsigned long raddr; unsigned long raddr;
int r; int r;
...@@ -174,8 +174,8 @@ long sys_shmat_wrapper(int shmid, char *shmaddr, int shmflag) ...@@ -174,8 +174,8 @@ long sys_shmat_wrapper(int shmid, char *shmaddr, int shmflag)
/* Fucking broken ABI */ /* Fucking broken ABI */
#ifdef CONFIG_PARISC64 #ifdef CONFIG_64BIT
asmlinkage long parisc_truncate64(const char * path, asmlinkage long parisc_truncate64(const char __user * path,
unsigned int high, unsigned int low) unsigned int high, unsigned int low)
{ {
return sys_truncate(path, (long)high << 32 | low); return sys_truncate(path, (long)high << 32 | low);
...@@ -189,7 +189,7 @@ asmlinkage long parisc_ftruncate64(unsigned int fd, ...@@ -189,7 +189,7 @@ asmlinkage long parisc_ftruncate64(unsigned int fd,
/* stubs for the benefit of the syscall_table since truncate64 and truncate /* stubs for the benefit of the syscall_table since truncate64 and truncate
* are identical on LP64 */ * are identical on LP64 */
asmlinkage long sys_truncate64(const char * path, unsigned long length) asmlinkage long sys_truncate64(const char __user * path, unsigned long length)
{ {
return sys_truncate(path, length); return sys_truncate(path, length);
} }
...@@ -203,7 +203,7 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg ...@@ -203,7 +203,7 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
} }
#else #else
asmlinkage long parisc_truncate64(const char * path, asmlinkage long parisc_truncate64(const char __user * path,
unsigned int high, unsigned int low) unsigned int high, unsigned int low)
{ {
return sys_truncate64(path, (loff_t)high << 32 | low); return sys_truncate64(path, (loff_t)high << 32 | low);
...@@ -216,13 +216,13 @@ asmlinkage long parisc_ftruncate64(unsigned int fd, ...@@ -216,13 +216,13 @@ asmlinkage long parisc_ftruncate64(unsigned int fd,
} }
#endif #endif
asmlinkage ssize_t parisc_pread64(unsigned int fd, char *buf, size_t count, asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count,
unsigned int high, unsigned int low) unsigned int high, unsigned int low)
{ {
return sys_pread64(fd, buf, count, (loff_t)high << 32 | low); return sys_pread64(fd, buf, count, (loff_t)high << 32 | low);
} }
asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char *buf, asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
size_t count, unsigned int high, unsigned int low) size_t count, unsigned int high, unsigned int low)
{ {
return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low); return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low);
......
...@@ -74,7 +74,7 @@ asmlinkage int sys32_execve(struct pt_regs *regs) ...@@ -74,7 +74,7 @@ asmlinkage int sys32_execve(struct pt_regs *regs)
char *filename; char *filename;
DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26])); DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26]));
filename = getname((char *) regs->gr[26]); filename = getname((const char __user *) regs->gr[26]);
error = PTR_ERR(filename); error = PTR_ERR(filename);
if (IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
...@@ -111,13 +111,13 @@ struct __sysctl_args32 { ...@@ -111,13 +111,13 @@ struct __sysctl_args32 {
u32 __unused[4]; u32 __unused[4];
}; };
asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
{ {
struct __sysctl_args32 tmp; struct __sysctl_args32 tmp;
int error; int error;
unsigned int oldlen32; unsigned int oldlen32;
size_t oldlen, *oldlenp = NULL; size_t oldlen, *oldlenp = NULL;
unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; unsigned long addr = (((long __force)&args->__unused[0]) + 7) & ~7;
extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
void *newval, size_t newlen); void *newval, size_t newlen);
...@@ -159,7 +159,7 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) ...@@ -159,7 +159,7 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
error = -EFAULT; error = -EFAULT;
} }
} }
if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused))) if (copy_to_user(&args->__unused[0], tmp.__unused, sizeof(tmp.__unused)))
error = -EFAULT; error = -EFAULT;
} }
return error; return error;
...@@ -168,19 +168,19 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) ...@@ -168,19 +168,19 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
#endif /* CONFIG_SYSCTL */ #endif /* CONFIG_SYSCTL */
asmlinkage long sys32_sched_rr_get_interval(pid_t pid, asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
struct compat_timespec *interval) struct compat_timespec __user *interval)
{ {
struct timespec t; struct timespec t;
int ret; int ret;
KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, &t); KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, (struct timespec __user *)&t);
if (put_compat_timespec(&t, interval)) if (put_compat_timespec(&t, interval))
return -EFAULT; return -EFAULT;
return ret; return ret;
} }
static int static int
put_compat_timeval(struct compat_timeval *u, struct timeval *t) put_compat_timeval(struct compat_timeval __user *u, struct timeval *t)
{ {
struct compat_timeval t32; struct compat_timeval t32;
t32.tv_sec = t->tv_sec; t32.tv_sec = t->tv_sec;
...@@ -188,7 +188,7 @@ put_compat_timeval(struct compat_timeval *u, struct timeval *t) ...@@ -188,7 +188,7 @@ put_compat_timeval(struct compat_timeval *u, struct timeval *t)
return copy_to_user(u, &t32, sizeof t32); return copy_to_user(u, &t32, sizeof t32);
} }
static inline long get_ts32(struct timespec *o, struct compat_timeval *i) static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
{ {
long usec; long usec;
...@@ -201,7 +201,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i) ...@@ -201,7 +201,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
} }
asmlinkage int asmlinkage int
sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
{ {
extern void do_gettimeofday(struct timeval *tv); extern void do_gettimeofday(struct timeval *tv);
...@@ -220,7 +220,7 @@ sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) ...@@ -220,7 +220,7 @@ sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
} }
asmlinkage asmlinkage
int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) int sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
{ {
struct timespec kts; struct timespec kts;
struct timezone ktz; struct timezone ktz;
...@@ -237,7 +237,7 @@ int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) ...@@ -237,7 +237,7 @@ int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
} }
int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
{ {
int err; int err;
...@@ -294,24 +294,24 @@ struct old_linux32_dirent { ...@@ -294,24 +294,24 @@ struct old_linux32_dirent {
}; };
struct getdents32_callback { struct getdents32_callback {
struct linux32_dirent * current_dir; struct linux32_dirent __user * current_dir;
struct linux32_dirent * previous; struct linux32_dirent __user * previous;
int count; int count;
int error; int error;
}; };
struct readdir32_callback { struct readdir32_callback {
struct old_linux32_dirent * dirent; struct old_linux32_dirent __user * dirent;
int count; int count;
}; };
#define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1))) #define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
static int static int
filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
unsigned int d_type) unsigned int d_type)
{ {
struct linux32_dirent * dirent; struct linux32_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf; struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4); int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
...@@ -327,17 +327,17 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, ...@@ -327,17 +327,17 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
put_user(reclen, &dirent->d_reclen); put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen); copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen); put_user(0, dirent->d_name + namlen);
dirent = (struct linux32_dirent *)((char *)dirent + reclen); dirent = ((void __user *)dirent) + reclen;
buf->current_dir = dirent; buf->current_dir = dirent;
buf->count -= reclen; buf->count -= reclen;
return 0; return 0;
} }
asmlinkage long asmlinkage long
sys32_getdents (unsigned int fd, void * dirent, unsigned int count) sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
{ {
struct file * file; struct file * file;
struct linux32_dirent * lastdirent; struct linux32_dirent __user * lastdirent;
struct getdents32_callback buf; struct getdents32_callback buf;
int error; int error;
...@@ -346,7 +346,7 @@ sys32_getdents (unsigned int fd, void * dirent, unsigned int count) ...@@ -346,7 +346,7 @@ sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
if (!file) if (!file)
goto out; goto out;
buf.current_dir = (struct linux32_dirent *) dirent; buf.current_dir = (struct linux32_dirent __user *) dirent;
buf.previous = NULL; buf.previous = NULL;
buf.count = count; buf.count = count;
buf.error = 0; buf.error = 0;
...@@ -372,7 +372,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ...@@ -372,7 +372,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t
unsigned int d_type) unsigned int d_type)
{ {
struct readdir32_callback * buf = (struct readdir32_callback *) __buf; struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
struct old_linux32_dirent * dirent; struct old_linux32_dirent __user * dirent;
if (buf->count) if (buf->count)
return -EINVAL; return -EINVAL;
...@@ -387,7 +387,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ...@@ -387,7 +387,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t
} }
asmlinkage long asmlinkage long
sys32_readdir (unsigned int fd, void * dirent, unsigned int count) sys32_readdir (unsigned int fd, void __user * dirent, unsigned int count)
{ {
int error; int error;
struct file * file; struct file * file;
...@@ -477,7 +477,7 @@ struct msgbuf32 { ...@@ -477,7 +477,7 @@ struct msgbuf32 {
}; };
asmlinkage long sys32_msgsnd(int msqid, asmlinkage long sys32_msgsnd(int msqid,
struct msgbuf32 *umsgp32, struct msgbuf32 __user *umsgp32,
size_t msgsz, int msgflg) size_t msgsz, int msgflg)
{ {
struct msgbuf *mb; struct msgbuf *mb;
...@@ -494,14 +494,14 @@ asmlinkage long sys32_msgsnd(int msqid, ...@@ -494,14 +494,14 @@ asmlinkage long sys32_msgsnd(int msqid,
if (err) if (err)
err = -EFAULT; err = -EFAULT;
else else
KERNEL_SYSCALL(err, sys_msgsnd, msqid, mb, msgsz, msgflg); KERNEL_SYSCALL(err, sys_msgsnd, msqid, (struct msgbuf __user *)mb, msgsz, msgflg);
kfree(mb); kfree(mb);
return err; return err;
} }
asmlinkage long sys32_msgrcv(int msqid, asmlinkage long sys32_msgrcv(int msqid,
struct msgbuf32 *umsgp32, struct msgbuf32 __user *umsgp32,
size_t msgsz, long msgtyp, int msgflg) size_t msgsz, long msgtyp, int msgflg)
{ {
struct msgbuf *mb; struct msgbuf *mb;
...@@ -511,7 +511,7 @@ asmlinkage long sys32_msgrcv(int msqid, ...@@ -511,7 +511,7 @@ asmlinkage long sys32_msgrcv(int msqid,
if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL) if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
KERNEL_SYSCALL(err, sys_msgrcv, msqid, mb, msgsz, msgtyp, msgflg); KERNEL_SYSCALL(err, sys_msgrcv, msqid, (struct msgbuf __user *)mb, msgsz, msgtyp, msgflg);
if (err >= 0) { if (err >= 0) {
len = err; len = err;
...@@ -528,7 +528,7 @@ asmlinkage long sys32_msgrcv(int msqid, ...@@ -528,7 +528,7 @@ asmlinkage long sys32_msgrcv(int msqid,
return err; return err;
} }
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -538,7 +538,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c ...@@ -538,7 +538,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c
return -EFAULT; return -EFAULT;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
set_fs(old_fs); set_fs(old_fs);
if (offset && put_user(of, offset)) if (offset && put_user(of, offset))
...@@ -547,9 +547,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c ...@@ -547,9 +547,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c
return ret; return ret;
} }
typedef long __kernel_loff_t32; /* move this to asm/posix_types.h? */ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -559,7 +557,7 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset ...@@ -559,7 +557,7 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset
return -EFAULT; return -EFAULT;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count); ret = sys_sendfile64(out_fd, in_fd, offset ? (loff_t __user *)&lof : NULL, count);
set_fs(old_fs); set_fs(old_fs);
if (offset && put_user(lof, offset)) if (offset && put_user(lof, offset))
...@@ -598,7 +596,7 @@ struct timex32 { ...@@ -598,7 +596,7 @@ struct timex32 {
int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32;
}; };
asmlinkage long sys32_adjtimex(struct timex32 *txc_p32) asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
{ {
struct timex txc; struct timex txc;
struct timex32 t32; struct timex32 t32;
...@@ -647,7 +645,7 @@ struct sysinfo32 { ...@@ -647,7 +645,7 @@ struct sysinfo32 {
* damage, I decided to just duplicate the code from sys_sysinfo here. * damage, I decided to just duplicate the code from sys_sysinfo here.
*/ */
asmlinkage int sys32_sysinfo(struct sysinfo32 *info) asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
{ {
struct sysinfo val; struct sysinfo val;
int err; int err;
...@@ -714,7 +712,7 @@ asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg) ...@@ -714,7 +712,7 @@ asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
return sys_semctl (semid, semnum, cmd, arg); return sys_semctl (semid, semnum, cmd, arg);
} }
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
size_t len) size_t len)
{ {
return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
......
...@@ -242,7 +242,7 @@ void handle_gdb_break(struct pt_regs *regs, int wot) ...@@ -242,7 +242,7 @@ void handle_gdb_break(struct pt_regs *regs, int wot)
struct siginfo si; struct siginfo si;
si.si_code = wot; si.si_code = wot;
si.si_addr = (void *) (regs->iaoq[0] & ~3); si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
si.si_signo = SIGTRAP; si.si_signo = SIGTRAP;
si.si_errno = 0; si.si_errno = 0;
force_sig_info(SIGTRAP, &si, current); force_sig_info(SIGTRAP, &si, current);
...@@ -263,7 +263,7 @@ void handle_break(unsigned iir, struct pt_regs *regs) ...@@ -263,7 +263,7 @@ void handle_break(unsigned iir, struct pt_regs *regs)
show_regs(regs); show_regs(regs);
#endif #endif
si.si_code = TRAP_BRKPT; si.si_code = TRAP_BRKPT;
si.si_addr = (void *) (regs->iaoq[0] & ~3); si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
si.si_signo = SIGTRAP; si.si_signo = SIGTRAP;
force_sig_info(SIGTRAP, &si, current); force_sig_info(SIGTRAP, &si, current);
break; break;
...@@ -281,7 +281,7 @@ void handle_break(unsigned iir, struct pt_regs *regs) ...@@ -281,7 +281,7 @@ void handle_break(unsigned iir, struct pt_regs *regs)
#endif #endif
si.si_signo = SIGTRAP; si.si_signo = SIGTRAP;
si.si_code = TRAP_BRKPT; si.si_code = TRAP_BRKPT;
si.si_addr = (void *) (regs->iaoq[0] & ~3); si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
force_sig_info(SIGTRAP, &si, current); force_sig_info(SIGTRAP, &si, current);
return; return;
} }
...@@ -569,7 +569,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -569,7 +569,7 @@ void handle_interruption(int code, struct pt_regs *regs)
give_sigill: give_sigill:
si.si_signo = SIGILL; si.si_signo = SIGILL;
si.si_errno = 0; si.si_errno = 0;
si.si_addr = (void *) regs->iaoq[0]; si.si_addr = (void __user *) regs->iaoq[0];
force_sig_info(SIGILL, &si, current); force_sig_info(SIGILL, &si, current);
return; return;
...@@ -577,7 +577,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -577,7 +577,7 @@ void handle_interruption(int code, struct pt_regs *regs)
/* Overflow Trap, let the userland signal handler do the cleanup */ /* Overflow Trap, let the userland signal handler do the cleanup */
si.si_signo = SIGFPE; si.si_signo = SIGFPE;
si.si_code = FPE_INTOVF; si.si_code = FPE_INTOVF;
si.si_addr = (void *) regs->iaoq[0]; si.si_addr = (void __user *) regs->iaoq[0];
force_sig_info(SIGFPE, &si, current); force_sig_info(SIGFPE, &si, current);
return; return;
...@@ -699,9 +699,9 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -699,9 +699,9 @@ void handle_interruption(int code, struct pt_regs *regs)
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_errno = 0; si.si_errno = 0;
if (code == 7) if (code == 7)
si.si_addr = (void *) regs->iaoq[0]; si.si_addr = (void __user *) regs->iaoq[0];
else else
si.si_addr = (void *) regs->ior; si.si_addr = (void __user *) regs->ior;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
return; return;
...@@ -721,7 +721,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -721,7 +721,7 @@ void handle_interruption(int code, struct pt_regs *regs)
si.si_signo = SIGBUS; si.si_signo = SIGBUS;
si.si_code = BUS_OBJERR; si.si_code = BUS_OBJERR;
si.si_errno = 0; si.si_errno = 0;
si.si_addr = (void *) regs->ior; si.si_addr = (void __user *) regs->ior;
force_sig_info(SIGBUS, &si, current); force_sig_info(SIGBUS, &si, current);
return; return;
} }
...@@ -745,7 +745,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -745,7 +745,7 @@ void handle_interruption(int code, struct pt_regs *regs)
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_errno = 0; si.si_errno = 0;
si.si_code = SEGV_MAPERR; si.si_code = SEGV_MAPERR;
si.si_addr = (void *) regs->ior; si.si_addr = (void __user *) regs->ior;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
return; return;
} }
......
...@@ -744,7 +744,7 @@ void handle_unaligned(struct pt_regs *regs) ...@@ -744,7 +744,7 @@ void handle_unaligned(struct pt_regs *regs)
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_errno = 0; si.si_errno = 0;
si.si_code = SEGV_MAPERR; si.si_code = SEGV_MAPERR;
si.si_addr = (void *)regs->ior; si.si_addr = (void __user *)regs->ior;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
} }
else else
...@@ -754,7 +754,7 @@ void handle_unaligned(struct pt_regs *regs) ...@@ -754,7 +754,7 @@ void handle_unaligned(struct pt_regs *regs)
si.si_signo = SIGBUS; si.si_signo = SIGBUS;
si.si_errno = 0; si.si_errno = 0;
si.si_code = BUS_ADRALN; si.si_code = BUS_ADRALN;
si.si_addr = (void *)regs->ior; si.si_addr = (void __user *)regs->ior;
force_sig_info(SIGBUS, &si, current); force_sig_info(SIGBUS, &si, current);
} }
......
...@@ -131,9 +131,9 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck); ...@@ -131,9 +131,9 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst, unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
int len, unsigned int sum, unsigned char *dst, int len,
int *err_ptr) unsigned int sum, int *err_ptr)
{ {
int missing; int missing;
......
...@@ -120,7 +120,7 @@ handle_fpe(struct pt_regs *regs) ...@@ -120,7 +120,7 @@ handle_fpe(struct pt_regs *regs)
si.si_signo = signalcode >> 24; si.si_signo = signalcode >> 24;
si.si_errno = 0; si.si_errno = 0;
si.si_code = signalcode & 0xffffff; si.si_code = signalcode & 0xffffff;
si.si_addr = (void *) regs->iaoq[0]; si.si_addr = (void __user *) regs->iaoq[0];
force_sig_info(si.si_signo, &si, current); force_sig_info(si.si_signo, &si, current);
return -1; return -1;
} }
......
...@@ -225,7 +225,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, ...@@ -225,7 +225,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_errno = 0; si.si_errno = 0;
si.si_code = SEGV_MAPERR; si.si_code = SEGV_MAPERR;
si.si_addr = (void *) address; si.si_addr = (void __user *) address;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
return; return;
} }
......
...@@ -30,8 +30,8 @@ extern unsigned int csum_partial_copy_nocheck(const unsigned char *, unsigned ch ...@@ -30,8 +30,8 @@ extern unsigned int csum_partial_copy_nocheck(const unsigned char *, unsigned ch
* this is a new version of the above that records errors it finds in *errp, * this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer. * but continues and zeros the rest of the buffer.
*/ */
extern unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
int len, unsigned int sum, int *errp); unsigned char *dst, int len, unsigned int sum, int *errp);
/* /*
* Optimized for IP headers, which always checksum on 4 octet boundaries. * Optimized for IP headers, which always checksum on 4 octet boundaries.
......
...@@ -131,15 +131,15 @@ typedef u32 compat_sigset_word; ...@@ -131,15 +131,15 @@ typedef u32 compat_sigset_word;
*/ */
typedef u32 compat_uptr_t; typedef u32 compat_uptr_t;
static inline void *compat_ptr(compat_uptr_t uptr) static inline void __user *compat_ptr(compat_uptr_t uptr)
{ {
return (void *)(unsigned long)uptr; return (void __user *)(unsigned long)uptr;
} }
static __inline__ void *compat_alloc_user_space(long len) static __inline__ void __user *compat_alloc_user_space(long len)
{ {
struct pt_regs *regs = &current->thread.regs; struct pt_regs *regs = &current->thread.regs;
return (void *)regs->gr[30]; return (void __user *)regs->gr[30];
} }
#endif /* _ASM_PARISC_COMPAT_H */ #endif /* _ASM_PARISC_COMPAT_H */
...@@ -123,13 +123,14 @@ struct siginfo; ...@@ -123,13 +123,14 @@ struct siginfo;
* compiler doesn't support code which changes or tests the address of * compiler doesn't support code which changes or tests the address of
* the function in the little struct. This is really ugly -PB * the function in the little struct. This is really ugly -PB
*/ */
typedef __kernel_caddr_t __sighandler_t; typedef char __user *__sighandler_t;
#else #else
typedef void (*__sighandler_t)(int); typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t;
#endif #endif
typedef struct sigaltstack { typedef struct sigaltstack {
void *ss_sp; void __user *ss_sp;
int ss_flags; int ss_flags;
size_t ss_size; size_t ss_size;
} stack_t; } stack_t;
......
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