GIT 392f6beb55c811a1f610717541af586aed59ac70 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/viro/bird.git#frv.b8 commit 392f6beb55c811a1f610717541af586aed59ac70 Author: Al Viro Date: Thu Feb 16 13:16:45 2006 -0500 [PATCH] frv: wrong syscall commit 6da7ca7c69d577584df9e660a63ccf55fc854857 Author: Al Viro Date: Tue Feb 14 14:30:37 2006 -0500 [PATCH] frv: misc sparse annotations Signed-off-by: Al Viro commit d9dab5fc26b0421cfff0f68bfd59b0ac10b9184e Author: Al Viro Date: Tue Feb 14 14:29:37 2006 -0500 [PATCH] frv: misc __user annotations Signed-off-by: Al Viro commit 791464ca5fbe42be661b4797ca5d556da8d8cca5 Author: Al Viro Date: Tue Feb 14 14:27:34 2006 -0500 [PATCH] frv: binfmt_elf_fdpic __user annotations Signed-off-by: Al Viro commit 10dce0be997ad3ccbaa7e4cb4b5850d25628294b Author: Al Viro Date: Tue Feb 14 14:26:46 2006 -0500 [PATCH] frv: sysctl __user annotations Signed-off-by: Al Viro commit 233cade2534baccbeb248d2896f4b5baee185e39 Author: Al Viro Date: Tue Feb 14 14:25:04 2006 -0500 [PATCH] frv: signal annotations Signed-off-by: Al Viro commit 6f39d6494136040aad9b718e4eaabab331b6654a Author: Al Viro Date: Tue Feb 14 14:23:10 2006 -0500 [PATCH] frv: basic __iomem annotations Signed-off-by: Al Viro commit 58d923068cbfe5e3b9bfc997b505e9105d09780f Author: Al Viro Date: Tue Feb 14 14:12:04 2006 -0500 [PATCH] frv: __user infrastructure Signed-off-by: Al Viro commit 780ab0aa33a73d180fda43f9bcc7cf7eb938075c Author: Al Viro Date: Thu Jan 19 03:47:15 2006 -0500 [PATCH] broken on frv... Signed-off-by: Al Viro --- diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index 1d21c8d..0af9fab 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S @@ -1480,7 +1480,7 @@ sys_call_table: .long sys_mknodat .long sys_fchownat .long sys_futimesat - .long sys_newfstatat /* 300 */ + .long sys_fstatat64 /* 300 */ .long sys_unlinkat .long sys_renameat .long sys_linkat diff --git a/arch/frv/kernel/irq-routing.c b/arch/frv/kernel/irq-routing.c index d4776d1..b90b70a 100644 --- a/arch/frv/kernel/irq-routing.c +++ b/arch/frv/kernel/irq-routing.c @@ -112,7 +112,7 @@ struct irq_source frv_cpuuart[2] = { #define __CPUUART(X, A) \ [X] = { \ .muxname = "uart", \ - .muxdata = (volatile void __iomem *) A, \ + .muxdata = (volatile void __iomem *)(unsigned long)A,\ .irqmask = 1 << IRQ_CPU_UART##X, \ .doirq = frv_cpuuart_doirq, \ } @@ -136,7 +136,7 @@ struct irq_source frv_cpudma[8] = { #define __CPUDMA(X, A) \ [X] = { \ .muxname = "dma", \ - .muxdata = (volatile void __iomem *) A, \ + .muxdata = (volatile void __iomem *)(unsigned long)A,\ .irqmask = 1 << IRQ_CPU_DMA##X, \ .doirq = frv_cpudma_doirq, \ } @@ -164,7 +164,7 @@ struct irq_source frv_cputimer[3] = { #define __CPUTIMER(X) \ [X] = { \ .muxname = "timer", \ - .muxdata = 0, \ + .muxdata = NULL, \ .irqmask = 1 << IRQ_CPU_TIMER##X, \ .doirq = frv_cputimer_doirq, \ } @@ -187,7 +187,7 @@ struct irq_source frv_cpuexternal[8] = { #define __CPUEXTERNAL(X) \ [X] = { \ .muxname = "ext", \ - .muxdata = 0, \ + .muxdata = NULL, \ .irqmask = 1 << IRQ_CPU_EXTERNAL##X, \ .doirq = frv_cpuexternal_doirq, \ } diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c index 27ab4c3..93114b7 100644 --- a/arch/frv/kernel/irq.c +++ b/arch/frv/kernel/irq.c @@ -627,7 +627,7 @@ static struct proc_dir_entry * irq_dir [ #define HEX_DIGITS 8 -static unsigned int parse_hex_value (const char *buffer, +static unsigned int parse_hex_value (const char __user *buffer, unsigned long count, unsigned long *ret) { unsigned char hexnum [HEX_DIGITS]; @@ -674,7 +674,7 @@ static int prof_cpu_mask_read_proc (char return sprintf (page, "%08lx\n", *mask); } -static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, +static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { unsigned long *mask = (unsigned long *) data, full_count = count, err; @@ -713,7 +713,7 @@ void init_irq_proc (void) int i; /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", 0); + root_irq_dir = proc_mkdir("irq", NULL); /* create /proc/irq/prof_cpu_mask */ entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir); diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c index f0b8fff..43ce28a 100644 --- a/arch/frv/kernel/pm.c +++ b/arch/frv/kernel/pm.c @@ -137,7 +137,7 @@ unsigned long sleep_phys_sp(void *sp) #define CTL_PM_P0 4 #define CTL_PM_CM 5 -static int user_atoi(char *ubuf, size_t len) +static int user_atoi(char __user *ubuf, size_t len) { char buf[16]; unsigned long ret; @@ -159,7 +159,7 @@ static int user_atoi(char *ubuf, size_t * Send us to sleep. */ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *fpos) + void __user *buffer, size_t *lenp, loff_t *fpos) { int retval, mode; @@ -215,7 +215,7 @@ static int try_set_cmode(int new_cmode) static int cmode_procctl(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *fpos) + void __user *buffer, size_t *lenp, loff_t *fpos) { int new_cmode; @@ -227,9 +227,9 @@ static int cmode_procctl(ctl_table *ctl, return try_set_cmode(new_cmode)?:*lenp; } -static int cmode_sysctl(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, void **context) +static int cmode_sysctl(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { if (oldval && oldlenp) { size_t oldlen; @@ -240,7 +240,7 @@ static int cmode_sysctl(ctl_table *table if (oldlen != sizeof(int)) return -EINVAL; - if (put_user(clock_cmode_current, (unsigned int *)oldval) || + if (put_user(clock_cmode_current, (unsigned __user *)oldval) || put_user(sizeof(int), oldlenp)) return -EFAULT; } @@ -250,7 +250,7 @@ static int cmode_sysctl(ctl_table *table if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new_cmode, (int *)newval)) + if (get_user(new_cmode, (int __user *)newval)) return -EFAULT; return try_set_cmode(new_cmode)?:1; @@ -318,7 +318,7 @@ static int try_set_cm(int new_cm) } static int p0_procctl(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *fpos) + void __user *buffer, size_t *lenp, loff_t *fpos) { int new_p0; @@ -330,9 +330,9 @@ static int p0_procctl(ctl_table *ctl, in return try_set_p0(new_p0)?:*lenp; } -static int p0_sysctl(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, void **context) +static int p0_sysctl(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { if (oldval && oldlenp) { size_t oldlen; @@ -343,7 +343,7 @@ static int p0_sysctl(ctl_table *table, i if (oldlen != sizeof(int)) return -EINVAL; - if (put_user(clock_p0_current, (unsigned int *)oldval) || + if (put_user(clock_p0_current, (unsigned __user *)oldval) || put_user(sizeof(int), oldlenp)) return -EFAULT; } @@ -353,7 +353,7 @@ static int p0_sysctl(ctl_table *table, i if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new_p0, (int *)newval)) + if (get_user(new_p0, (int __user *)newval)) return -EFAULT; return try_set_p0(new_p0)?:1; @@ -362,7 +362,7 @@ static int p0_sysctl(ctl_table *table, i } static int cm_procctl(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *fpos) + void __user *buffer, size_t *lenp, loff_t *fpos) { int new_cm; @@ -374,9 +374,9 @@ static int cm_procctl(ctl_table *ctl, in return try_set_cm(new_cm)?:*lenp; } -static int cm_sysctl(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, void **context) +static int cm_sysctl(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { if (oldval && oldlenp) { size_t oldlen; @@ -387,7 +387,7 @@ static int cm_sysctl(ctl_table *table, i if (oldlen != sizeof(int)) return -EINVAL; - if (put_user(clock_cm_current, (unsigned int *)oldval) || + if (put_user(clock_cm_current, (unsigned __user *)oldval) || put_user(sizeof(int), oldlenp)) return -EFAULT; } @@ -397,7 +397,7 @@ static int cm_sysctl(ctl_table *table, i if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new_cm, (int *)newval)) + if (get_user(new_cm, (int __user *)newval)) return -EFAULT; return try_set_cm(new_cm)?:1; diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 0fff8a6..489e6c4 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -246,7 +246,7 @@ int copy_thread(int nr, unsigned long cl /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(char *name, char **argv, char **envp) +asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { int error; char * filename; diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 679c1d5..dd5e6fd 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c @@ -98,7 +98,7 @@ int sys_sigaltstack(const stack_t __user struct sigframe { - void (*pretcode)(void); + __sigrestore_t pretcode; int sig; struct sigcontext sc; unsigned long extramask[_NSIG_WORDS-1]; @@ -107,10 +107,10 @@ struct sigframe struct rt_sigframe { - void (*pretcode)(void); + __sigrestore_t pretcode; int sig; - struct siginfo *pinfo; - void *puc; + struct siginfo __user *pinfo; + void __user *puc; struct siginfo info; struct ucontext uc; uint32_t retcode[2]; @@ -284,7 +284,7 @@ static int setup_frame(int sig, struct k * setlos #__NR_sigreturn,gr7 * tira gr0,0 */ - if (__put_user((void (*)(void))frame->retcode, &frame->pretcode) || + if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) || __put_user(0xc0700000, &frame->retcode[1])) goto give_sigsegv; @@ -300,7 +300,7 @@ static int setup_frame(int sig, struct k if (get_personality & FDPIC_FUNCPTRS) { struct fdpic_func_descriptor __user *funcptr = - (struct fdpic_func_descriptor *) ka->sa.sa_handler; + (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; __get_user(__frame->pc, &funcptr->text); __get_user(__frame->gr15, &funcptr->GOT); } else { @@ -359,8 +359,8 @@ static int setup_rt_frame(int sig, struc /* Create the ucontext. */ if (__put_user(0, &frame->uc.uc_flags) || - __put_user(0, &frame->uc.uc_link) || - __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || + __put_user(NULL, &frame->uc.uc_link) || + __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) || __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size)) goto give_sigsegv; @@ -382,7 +382,7 @@ static int setup_rt_frame(int sig, struc * setlos #__NR_sigreturn,gr7 * tira gr0,0 */ - if (__put_user((void (*)(void))frame->retcode, &frame->pretcode) || + if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) || __put_user(0xc0700000, &frame->retcode[1])) goto give_sigsegv; @@ -398,7 +398,7 @@ static int setup_rt_frame(int sig, struc __frame->gr9 = (unsigned long) &frame->info; if (get_personality & FDPIC_FUNCPTRS) { - struct fdpic_func_descriptor *funcptr = + struct fdpic_func_descriptor __user *funcptr = (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; __get_user(__frame->pc, &funcptr->text); __get_user(__frame->gr15, &funcptr->GOT); diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c index 931aa6d..c4d4348 100644 --- a/arch/frv/kernel/sys_frv.c +++ b/arch/frv/kernel/sys_frv.c @@ -32,7 +32,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way unix traditionally does this, though. */ -asmlinkage long sys_pipe(unsigned long * fildes) +asmlinkage long sys_pipe(unsigned long __user * fildes) { int fd[2]; int error; diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c index 408b0f3..b908863 100644 --- a/arch/frv/kernel/sysctl.c +++ b/arch/frv/kernel/sysctl.c @@ -49,7 +49,7 @@ static void frv_change_dcache_mode(unsig * handle requests to dynamically switch the write caching mode delivered by /proc */ static int procctl_frv_cachemode(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *ppos) + void __user *buffer, size_t *lenp, loff_t *ppos) { unsigned long hsr0; char buff[8]; @@ -123,7 +123,7 @@ static int procctl_frv_cachemode(ctl_tab */ #ifdef CONFIG_MMU static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp, loff_t *ppos) + void __user *buffer, size_t *lenp, loff_t *ppos) { pid_t pid; char buff[16], *p; diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c index 9b751c0..9fb771a 100644 --- a/arch/frv/kernel/uaccess.c +++ b/arch/frv/kernel/uaccess.c @@ -17,7 +17,7 @@ /* * copy a null terminated string from userspace */ -long strncpy_from_user(char *dst, const char *src, long count) +long strncpy_from_user(char *dst, const char __user *src, long count) { unsigned long max; char *p, ch; @@ -70,9 +70,9 @@ EXPORT_SYMBOL(strncpy_from_user); * * Return 0 on exception, a value greater than N if too long */ -long strnlen_user(const char *src, long count) +long strnlen_user(const char __user *src, long count) { - const char *p; + const char __user *p; long err = 0; char ch; diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c index c4a1144..45ae39d 100644 --- a/arch/frv/mb93090-mb00/pci-irq.c +++ b/arch/frv/mb93090-mb00/pci-irq.c @@ -32,11 +32,11 @@ */ static const uint8_t __initdata pci_bus0_irq_routing[32][4] = { - [0 ] { IRQ_FPGA_MB86943_PCI_INTA }, - [16] { IRQ_FPGA_RTL8029_INTA }, - [17] { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, - [18] { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA }, - [19] { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD }, + [0 ] = { IRQ_FPGA_MB86943_PCI_INTA }, + [16] = { IRQ_FPGA_RTL8029_INTA }, + [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, + [18] = { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA }, + [19] = { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD }, }; void __init pcibios_irq_init(void) diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c index c54f18e..40b62c5 100644 --- a/arch/frv/mm/kmap.c +++ b/arch/frv/mm/kmap.c @@ -31,15 +31,15 @@ * Map some physical address range into the kernel address space. */ -void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) +void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) { - return (void *)physaddr; + return (void __iomem *)physaddr; } /* * Unmap a ioremap()ed region again */ -void iounmap(void *addr) +void iounmap(void volatile __iomem *addr) { } diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index 39142e2..aac5cb2 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig @@ -4,7 +4,7 @@ menu "IEEE 1394 (FireWire) support" config IEEE1394 tristate "IEEE 1394 (FireWire) support" - depends on PCI || BROKEN + depends on (PCI || BROKEN) && (BROKEN || !FRV) select NET help IEEE 1394 describes a high performance serial bus, which is also diff --git a/drivers/net/tokenring/Kconfig b/drivers/net/tokenring/Kconfig index e4cfc80..2129277 100644 --- a/drivers/net/tokenring/Kconfig +++ b/drivers/net/tokenring/Kconfig @@ -84,7 +84,7 @@ config 3C359 config TMS380TR tristate "Generic TMS380 Token Ring ISA/PCI adapter support" - depends on TR && (PCI || ISA && ISA_DMA_API || MCA) + depends on TR && (PCI || ISA && ISA_DMA_API || MCA) && (BROKEN || !FRV) select FW_LOADER ---help--- This driver provides generic support for token ring adapters diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 5b3076e..0458d2f 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -435,9 +435,10 @@ static int create_elf_fdpic_tables(struc struct elf_fdpic_params *interp_params) { unsigned long sp, csp, nitems; - elf_caddr_t *argv, *envp; + elf_caddr_t __user *argv, *envp; size_t platform_len = 0, len; - char *k_platform, *u_platform, *p; + char *k_platform; + char __user *u_platform, *p; long hwcap; int loop; @@ -462,12 +463,11 @@ static int create_elf_fdpic_tables(struc if (k_platform) { platform_len = strlen(k_platform) + 1; sp -= platform_len; + u_platform = (char __user *) sp; if (__copy_to_user(u_platform, k_platform, platform_len) != 0) return -EFAULT; } - u_platform = (char *) sp; - #if defined(__i386__) && defined(CONFIG_SMP) /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions * by the processes running on the same package. One thing we can do @@ -490,7 +490,7 @@ static int create_elf_fdpic_tables(struc sp = (sp - len) & ~7UL; exec_params->map_addr = sp; - if (copy_to_user((void *) sp, exec_params->loadmap, len) != 0) + if (copy_to_user((void __user *) sp, exec_params->loadmap, len) != 0) return -EFAULT; current->mm->context.exec_fdpic_loadmap = (unsigned long) sp; @@ -501,7 +501,7 @@ static int create_elf_fdpic_tables(struc sp = (sp - len) & ~7UL; interp_params->map_addr = sp; - if (copy_to_user((void *) sp, interp_params->loadmap, len) != 0) + if (copy_to_user((void __user *) sp, interp_params->loadmap, len) != 0) return -EFAULT; current->mm->context.interp_fdpic_loadmap = (unsigned long) sp; @@ -527,7 +527,7 @@ static int create_elf_fdpic_tables(struc /* put the ELF interpreter info on the stack */ #define NEW_AUX_ENT(nr, id, val) \ do { \ - struct { unsigned long _id, _val; } *ent = (void *) csp; \ + struct { unsigned long _id, _val; } __user *ent = (void __user *) csp; \ __put_user((id), &ent[nr]._id); \ __put_user((val), &ent[nr]._val); \ } while (0) @@ -564,13 +564,13 @@ static int create_elf_fdpic_tables(struc /* allocate room for argv[] and envv[] */ csp -= (bprm->envc + 1) * sizeof(elf_caddr_t); - envp = (elf_caddr_t *) csp; + envp = (elf_caddr_t __user *) csp; csp -= (bprm->argc + 1) * sizeof(elf_caddr_t); - argv = (elf_caddr_t *) csp; + argv = (elf_caddr_t __user *) csp; /* stack argc */ csp -= sizeof(unsigned long); - __put_user(bprm->argc, (unsigned long *) csp); + __put_user(bprm->argc, (unsigned long __user *) csp); if (csp != sp) BUG(); @@ -582,7 +582,7 @@ static int create_elf_fdpic_tables(struc current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p); #endif - p = (char *) current->mm->arg_start; + p = (char __user *) current->mm->arg_start; for (loop = bprm->argc; loop > 0; loop--) { __put_user((elf_caddr_t) p, argv++); len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES); @@ -1026,7 +1026,7 @@ static int elf_fdpic_map_file_by_direct_ /* clear the bit between beginning of mapping and beginning of PT_LOAD */ if (prot & PROT_WRITE && disp > 0) { kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp); - clear_user((void *) maddr, disp); + clear_user((void __user *) maddr, disp); maddr += disp; } @@ -1060,7 +1060,7 @@ static int elf_fdpic_map_file_by_direct_ if (prot & PROT_WRITE && excess1 > 0) { kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr + phdr->p_filesz, excess1); - clear_user((void *) maddr + phdr->p_filesz, excess1); + clear_user((void __user *) maddr + phdr->p_filesz, excess1); } #else diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h index 10236f6..42bf0db 100644 --- a/include/asm-frv/checksum.h +++ b/include/asm-frv/checksum.h @@ -43,7 +43,7 @@ unsigned int csum_partial_copy(const cha * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary */ -extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, +extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, int sum, int *csum_err); #define csum_partial_copy_nocheck(src, dst, len, sum) \ diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h index 295f74a..399e043 100644 --- a/include/asm-frv/highmem.h +++ b/include/asm-frv/highmem.h @@ -135,7 +135,7 @@ static inline void *kmap_atomic(struct p default: BUG(); - return 0; + return NULL; } } diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h index 01247cb..0c18453 100644 --- a/include/asm-frv/io.h +++ b/include/asm-frv/io.h @@ -41,13 +41,13 @@ static inline unsigned long _swapl(unsig //#define __iormb() asm volatile("membar") //#define __iowmb() asm volatile("membar") -#define __raw_readb(addr) __builtin_read8((void *) (addr)) -#define __raw_readw(addr) __builtin_read16((void *) (addr)) -#define __raw_readl(addr) __builtin_read32((void *) (addr)) - -#define __raw_writeb(datum, addr) __builtin_write8((void *) (addr), datum) -#define __raw_writew(datum, addr) __builtin_write16((void *) (addr), datum) -#define __raw_writel(datum, addr) __builtin_write32((void *) (addr), datum) +#define __raw_readb __builtin_read8 +#define __raw_readw __builtin_read16 +#define __raw_readl __builtin_read32 + +#define __raw_writeb(datum, addr) __builtin_write8(addr, datum) +#define __raw_writew(datum, addr) __builtin_write16(addr, datum) +#define __raw_writel(datum, addr) __builtin_write32(addr, datum) static inline void io_outsb(unsigned int addr, const void *buf, int len) { @@ -129,12 +129,12 @@ static inline void memcpy_toio(volatile static inline uint8_t inb(unsigned long addr) { - return __builtin_read8((void *)addr); + return __builtin_read8((void __iomem *)addr); } static inline uint16_t inw(unsigned long addr) { - uint16_t ret = __builtin_read16((void *)addr); + uint16_t ret = __builtin_read16((void __iomem *)addr); if (__is_PCI_IO(addr)) ret = _swapw(ret); @@ -144,7 +144,7 @@ static inline uint16_t inw(unsigned long static inline uint32_t inl(unsigned long addr) { - uint32_t ret = __builtin_read32((void *)addr); + uint32_t ret = __builtin_read32((void __iomem *)addr); if (__is_PCI_IO(addr)) ret = _swapl(ret); @@ -154,21 +154,21 @@ static inline uint32_t inl(unsigned long static inline void outb(uint8_t datum, unsigned long addr) { - __builtin_write8((void *)addr, datum); + __builtin_write8((void __iomem *)addr, datum); } static inline void outw(uint16_t datum, unsigned long addr) { if (__is_PCI_IO(addr)) datum = _swapw(datum); - __builtin_write16((void *)addr, datum); + __builtin_write16((void __iomem *)addr, datum); } static inline void outl(uint32_t datum, unsigned long addr) { if (__is_PCI_IO(addr)) datum = _swapl(datum); - __builtin_write32((void *)addr, datum); + __builtin_write32((void __iomem *)addr, datum); } #define inb_p(addr) inb(addr) @@ -190,12 +190,12 @@ static inline void outl(uint32_t datum, static inline uint8_t readb(const volatile void __iomem *addr) { - return __builtin_read8((volatile uint8_t __force *) addr); + return __builtin_read8((__force void volatile __iomem *) addr); } static inline uint16_t readw(const volatile void __iomem *addr) { - uint16_t ret = __builtin_read16((volatile uint16_t __force *)addr); + uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr); if (__is_PCI_MEM(addr)) ret = _swapw(ret); @@ -204,7 +204,7 @@ static inline uint16_t readw(const volat static inline uint32_t readl(const volatile void __iomem *addr) { - uint32_t ret = __builtin_read32((volatile uint32_t __force *)addr); + uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr); if (__is_PCI_MEM(addr)) ret = _swapl(ret); @@ -218,7 +218,7 @@ static inline uint32_t readl(const volat static inline void writeb(uint8_t datum, volatile void __iomem *addr) { - __builtin_write8((volatile uint8_t __force *) addr, datum); + __builtin_write8(addr, datum); if (__is_PCI_MEM(addr)) __flush_PCI_writes(); } @@ -228,7 +228,7 @@ static inline void writew(uint16_t datum if (__is_PCI_MEM(addr)) datum = _swapw(datum); - __builtin_write16((volatile uint16_t __force *) addr, datum); + __builtin_write16(addr, datum); if (__is_PCI_MEM(addr)) __flush_PCI_writes(); } @@ -238,7 +238,7 @@ static inline void writel(uint32_t datum if (__is_PCI_MEM(addr)) datum = _swapl(datum); - __builtin_write32((volatile uint32_t __force *) addr, datum); + __builtin_write32(addr, datum); if (__is_PCI_MEM(addr)) __flush_PCI_writes(); } @@ -272,7 +272,7 @@ static inline void __iomem *ioremap_full return __ioremap(physaddr, size, IOMAP_FULL_CACHING); } -extern void iounmap(void __iomem *addr); +extern void iounmap(void volatile __iomem *addr); static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) { diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h index 93fa732..219e5f9 100644 --- a/include/asm-frv/mb-regs.h +++ b/include/asm-frv/mb-regs.h @@ -16,6 +16,17 @@ #include #include +#ifndef __ASSEMBLY__ +/* gcc builtins, annotated */ + +unsigned long __builtin_read8(volatile void __iomem *); +unsigned long __builtin_read16(volatile void __iomem *); +unsigned long __builtin_read32(volatile void __iomem *); +void __builtin_write8(volatile void __iomem *, unsigned char); +void __builtin_write16(volatile void __iomem *, unsigned short); +void __builtin_write32(volatile void __iomem *, unsigned long); +#endif + #define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable * protection laid over the top for use in memory-mapped * I/O @@ -59,7 +70,7 @@ #define __region_PCI_MEM (__region_CS2 + 0x08000000UL) #define __flush_PCI_writes() \ do { \ - __builtin_write8((volatile void *) __region_PCI_MEM, 0); \ + __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \ } while(0) #define __is_PCI_IO(addr) \ @@ -83,15 +94,15 @@ extern int __nongprelbss mb93090_mb00_de #define __set_LEDS(X) \ do { \ if (mb93090_mb00_detected) \ - __builtin_write32((void *) __addr_LEDS(), ~(X)); \ + __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \ } while (0) #else #define __set_LEDS(X) #endif #define __addr_LCD() (__region_CS2 + 0x01200008UL) -#define __get_LCD(B) __builtin_read32((volatile void *) (B)) -#define __set_LCD(B,X) __builtin_write32((volatile void *) (B), (X)) +#define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B)) +#define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X)) #define LCD_D 0x000000ff /* LCD data bus */ #define LCD_RW 0x00000100 /* LCD R/W signal */ @@ -161,11 +172,11 @@ do { \ #define __get_CLKIN() 66000000UL #define __addr_LEDS() (__region_CS2 + 0x00000023UL) -#define __set_LEDS(X) __builtin_write8((volatile void *) __addr_LEDS(), (X)) +#define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X)) #define __addr_FPGATR() (__region_CS2 + 0x00000030UL) -#define __set_FPGATR(X) __builtin_write32((volatile void *) __addr_FPGATR(), (X)) -#define __get_FPGATR() __builtin_read32((volatile void *) __addr_FPGATR()) +#define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X)) +#define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR()) #define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 @@ -180,7 +191,7 @@ do { \ #define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) #define MB93093_FPGA_SWR_PUSHSW4 (1<<29) -#define __addr_FPGA_SWR ((volatile void *)(__region_CS2 + 0x28UL)) +#define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL)) #define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h index 6736689..dcc1b35 100644 --- a/include/asm-frv/signal.h +++ b/include/asm-frv/signal.h @@ -114,13 +114,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 */ }; @@ -146,7 +146,7 @@ struct sigaction { #endif /* __KERNEL__ */ typedef struct sigaltstack { - void *ss_sp; + void __user *ss_sp; int ss_flags; size_t ss_size; } stack_t; diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h index a1d1404..3d90e10 100644 --- a/include/asm-frv/uaccess.h +++ b/include/asm-frv/uaccess.h @@ -22,7 +22,7 @@ #define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ -#define __ptr(x) ((unsigned long *)(x)) +#define __ptr(x) ((unsigned long __force *)(x)) #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -64,7 +64,7 @@ static inline int ___range_ok(unsigned l #define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size)) -#define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0) +#define access_ok(type,addr,size) (__range_ok((void __user *)(addr), (size)) == 0) #define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) /* @@ -97,6 +97,7 @@ extern unsigned long search_exception_ta int __pu_err = 0; \ \ typeof(*(ptr)) __pu_val = (x); \ + __chk_user_ptr(ptr); \ \ switch (sizeof (*(ptr))) { \ case 1: \ @@ -120,7 +121,7 @@ extern unsigned long search_exception_ta #define put_user(x, ptr) \ ({ \ - typeof(&*ptr) _p = (ptr); \ + typeof(*(ptr)) __user *_p = (ptr); \ int _e; \ \ _e = __range_ok(_p, sizeof(*_p)); \ @@ -175,33 +176,44 @@ do { \ */ #define __get_user(x, ptr) \ ({ \ - typeof(*(ptr)) __gu_val = 0; \ int __gu_err = 0; \ + __chk_user_ptr(ptr); \ \ switch (sizeof(*(ptr))) { \ - case 1: \ - __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \ + case 1: { \ + unsigned char __gu_val; \ + __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \ + (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ break; \ - case 2: \ - __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \ + } \ + case 2: { \ + unsigned short __gu_val; \ + __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \ + (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ break; \ - case 4: \ - __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \ + } \ + case 4: { \ + unsigned int __gu_val; \ + __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \ + (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ break; \ - case 8: \ - __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \ + } \ + case 8: { \ + unsigned long long __gu_val; \ + __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \ + (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ break; \ + } \ default: \ __gu_err = __get_user_bad(); \ break; \ } \ - (x) = __gu_val; \ __gu_err; \ }) #define get_user(x, ptr) \ ({ \ - typeof(&*ptr) _p = (ptr); \ + const typeof(*(ptr)) __user *_p = (ptr);\ int _e; \ \ _e = __range_ok(_p, sizeof(*_p)); \ @@ -248,19 +260,20 @@ do { \ /* * */ +#define ____force(x) (__force void *)(void __user *)(x) #ifdef CONFIG_MMU extern long __memset_user(void *dst, unsigned long count); extern long __memcpy_user(void *dst, const void *src, unsigned long count); -#define clear_user(dst,count) __memset_user((dst), (count)) -#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) -#define __copy_to_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) +#define clear_user(dst,count) __memset_user(____force(dst), (count)) +#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) +#define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) #else -#define clear_user(dst,count) (memset((dst), 0, (count)), 0) -#define __copy_from_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) -#define __copy_to_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) +#define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) +#define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) +#define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) #endif @@ -278,7 +291,7 @@ __copy_from_user(void *to, const void __ return __copy_from_user_inatomic(to, from, n); } -static inline long copy_from_user(void *to, const void *from, unsigned long n) +static inline long copy_from_user(void *to, const void __user *from, unsigned long n) { unsigned long ret = n; @@ -291,16 +304,13 @@ static inline long copy_from_user(void * return ret; } -static inline long copy_to_user(void *to, const void *from, unsigned long n) +static inline long copy_to_user(void __user *to, const void *from, unsigned long n) { return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n; } -#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) -#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) - -extern long strncpy_from_user(char *dst, const char *src, long count); -extern long strnlen_user(const char *src, long count); +extern long strncpy_from_user(char *dst, const char __user *src, long count); +extern long strnlen_user(const char __user *src, long count); #define strlen_user(str) strnlen_user(str, 32767) diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h index 322531c..8f01cf1 100644 --- a/include/asm-frv/unistd.h +++ b/include/asm-frv/unistd.h @@ -306,7 +306,7 @@ #define __NR_mknodat 297 #define __NR_fchownat 298 #define __NR_futimesat 299 -#define __NR_newfstatat 300 +#define __NR_fstatat64 300 #define __NR_unlinkat 301 #define __NR_renameat 302 #define __NR_linkat 303 diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 9fd8d4f..e93aefa 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -38,7 +38,7 @@ config PM_DEBUG config SOFTWARE_SUSPEND bool "Software Suspend" - depends on PM && SWAP && (X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP) + depends on PM && SWAP && (X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP) && (BROKEN || !FRV) ---help--- Enable the possibility of suspending the machine. It doesn't need APM.