frv: __user infrastructure
Subsystems (4)
PATCH 1/15 frv: __user infrastructure
From: Al Viro <[email protected]>
Add general annotations to the FRV arch for sparse.
---
arch/frv/kernel/uaccess.c | 6 ++-- include/asm-frv/uaccess.h | 64 ++++++++++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 30 deletions(-)
arch/frv/kernel/uaccess.c +3 -3
@@ -17,7 +17,7 @@ #include <asm/uaccess.h>/* * 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;
include/asm-frv/uaccess.h +37 -27
139 lines not on this page · raw message
PATCH 2/15 frv: basic __iomem annotations
From: Al Viro <[email protected]>
Add annotations to the FRV I/O handling functions for sparse.
---
arch/frv/mm/kmap.c | 6 +++--- include/asm-frv/io.h | 38 +++++++++++++++++++------------------- include/asm-frv/mb-regs.h | 27 +++++++++++++++++++-------- 3 files changed, 41 insertions(+), 30 deletions(-)
arch/frv/mm/kmap.c +3 -3
@@ -31,15 +31,15 @@ #undef DEBUG* 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) { }
include/asm-frv/io.h +19 -19
@@ -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_readb __builtin_read8 +#define __raw_readw __builtin_read16 +#define __raw_readl __builtin_read32 -#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_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(volatilestatic 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 longstatic 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 longstatic 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 @@ #define IO_SPACE_LIMIT 0xffffffffstatic 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 volatstatic 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 @@ #define readl_relaxed readlstatic 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 datumif (__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 datumif (__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_fullreturn __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) {
include/asm-frv/mb-regs.h +19 -8
@@ -16,6 +16,17 @@ #include <asm/cpu-irqs.h>#include <asm/sections.h> #include <asm/mem-layout.h> +#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_IO (__region_CS2 +#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 @@ #ifdef CONFIG_MB93090_MB00#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 @@ #define __get_CLKSW() 0UL#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 @@ #define MB93093_FPGA_FPGATR_AUDIO_CLK_02#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)
PATCH 3/15 frv: signal annotations
In reply to David HowellsFrom: Al Viro <[email protected]>
Add annotations to the FRV signal handling for sparse.
---
arch/frv/kernel/signal.c | 20 ++++++++++---------- include/asm-frv/signal.h | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-)
arch/frv/kernel/signal.c +10 -10
@@ -98,7 +98,7 @@ int sys_sigaltstack(const stack_t __userstruct sigframe { -void (*pretcode)(void ); +__sigrestore_t pretcode;int sig;struct sigcontext sc;unsigned long extramask[_NSIG_WORDS-1 ];
@@ -107,10 +107,10 @@ struct sigframestruct 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 kif (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);
include/asm-frv/signal.h +3 -3
@@ -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 @@ #define sa_sigaction _u._sa_sigaction#endif /* __KERNEL__ */ typedef struct sigaltstack { -void *ss_sp; +void __user *ss_sp;int ss_flags;size_t ss_size; }stack_t ;
PATCH 4/15 frv: sysctl __user annotations
In reply to David HowellsFrom: Al Viro <[email protected]>
Add __user annotations to FRV-specific sysctl stuff.
---
arch/frv/kernel/pm.c | 40 ++++++++++++++++++++-------------------- arch/frv/kernel/sysctl.c | 4 ++-- 2 files changed, 22 insertions(+), 22 deletions(-)
arch/frv/kernel/pm.c +20 -20
@@ -137,7 +137,7 @@ #define CTL_PM_CMODE 2#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 @@ #endifstatic 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 *tableif (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 *tableif (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 @@ #endif }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, inreturn 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, iif (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, iif (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, inreturn 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, iif (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, iif (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 ;
arch/frv/kernel/sysctl.c +2 -2
@@ -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;
PATCH 5/15 frv: binfmt_elf_fdpic __user annotations
In reply to David HowellsFrom: Al Viro <[email protected]>
Add __user annotations to binfmt_elf_fdpic.
---
fs/binfmt_elf_fdpic.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
fs/binfmt_elf_fdpic.c +13 -13
@@ -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 @@ #endifif (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 @@ #endif 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 @@ #endif 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 @@ #endif/* 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 @@ #undef NEW_AUX_ENT/* 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);BUG_ON (csp != sp);
@@ -581,7 +581,7 @@ #else 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 );
@@ -1025,7 +1025,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; }
@@ -1059,7 +1059,7 @@ #ifdef CONFIG_MMUif (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
PATCH 6/15 frv: misc __user annotations
In reply to David HowellsFrom: Al Viro <[email protected]>
---
arch/frv/kernel/irq.c | 6 +++--- arch/frv/kernel/process.c | 2 +- arch/frv/kernel/sys_frv.c | 2 +- include/asm-frv/checksum.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/frv/kernel/irq.c +3 -3
@@ -625,7 +625,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 ];
@@ -672,7 +672,7 @@ static int prof_cpu_mask_read_proc (charreturn 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;
@@ -711,7 +711,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);
arch/frv/kernel/process.c +1 -1
@@ -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;
arch/frv/kernel/sys_frv.c +1 -1
@@ -32,7 +32,7 @@ #include <asm/ipc.h>* 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;
include/asm-frv/checksum.h +1 -1
@@ -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) \
PATCH 7/15 frv: misc sparse annotations
In reply to David HowellsFrom: Al Viro <[email protected]>
---
arch/frv/kernel/irq-routing.c | 8 ++++---- arch/frv/mb93090-mb00/pci-irq.c | 10 +++++----- include/asm-frv/highmem.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-)
arch/frv/kernel/irq-routing.c +4 -4
@@ -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, \ }
arch/frv/mb93090-mb00/pci-irq.c +5 -5
@@ -32,11 +32,11 @@ #include "pci-frv.h"*/ 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 )
include/asm-frv/highmem.h +1 -1
@@ -135,7 +135,7 @@ static inline void *kmap_atomic(struct pdefault :BUG (); -return 0 ; +return NULL ; } }
PATCH 8/15 frv: wrong syscall
In reply to David HowellsFrom: Al Viro <[email protected]>
The FRV arch should use fstatat64 not newfstatat.
---
arch/frv/kernel/entry.S | 2 +- include/asm-frv/unistd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/frv/kernel/entry.S +1 -1
@@ -1474,7 +1474,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
include/asm-frv/unistd.h +1 -1
@@ -306,7 +306,7 @@ #define __NR_mkdirat 296#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
PATCH 9/15 ext2 XIP won't build without MMU
In reply to David HowellsFrom: Al Viro <[email protected]>
Disable Ext2 XIP if the kernel is configured in no-MMU mode as the former won't build.
---
fs/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/Kconfig +1 -1
@@ -53,7 +53,7 @@ config EXT2_FS_SECURITY config EXT2_FS_XIP bool "Ext2 execute in place support" - depends on EXT2_FS + depends on EXT2_FS && MMU help Execute in place can be used on memory-backed block devices. If you enable this option, you can select to mount block devices which are
PATCH 10/15 frv: initrd is grossly broken on frv (never built)
In reply to David HowellsFrom: Al Viro <[email protected]>
The FRV arch doesn't currently support initrd, so it should be disabled automatically for the moment.
---
drivers/block/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/block/Kconfig +1 -0
@@ -402,6 +402,7 @@ config BLK_DEV_RAM_SIZE config BLK_DEV_INITRD bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" + depends on BROKEN || !FRV help The initial RAM filesystem is a ramfs which is loaded by the boot loader (loadlin or lilo) and that is mounted as root
PATCH 11/15 frv: NULL noise removal in frv xchg()
In reply to David HowellsFrom: Al Viro <[email protected]>
Clean up the FRV arch's xchg() function.
---
include/asm-frv/atomic.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-frv/atomic.h +2 -2
@@ -228,7 +228,7 @@ ({ \break ; \ \default : \ - __xg_orig =0 ; \ + __xg_orig = (__typeof__ (__xg_orig ))0 ; \ asmvolatile ("break" ); \break ; \ } \
@@ -248,7 +248,7 @@ ({ \switch (sizeof (__xg_orig)) { \case 4 : __xg_orig = (__typeof__ (*(ptr )))__xchg_32 ((uint32_t ) x, __xg_ptr);break ; \default : \ - __xg_orig =0 ; \ + __xg_orig = (__typeof__ (__xg_orig ))0 ; \ asmvolatile ("break" ); \break ; \ } \
PATCH 12/15 frv: ieee1394 is borken on frv
In reply to David HowellsFrom: Al Viro <[email protected]>
The ieee1394 assumes it may make direct use of ->count in the semaphore structure.
---
drivers/ieee1394/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ieee1394/Kconfig +1 -1
@@ -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
PATCH 13/15 frv: Add missing qualifier to memcpy_fromio() prototype
In reply to David HowellsFrom: Al Viro <[email protected]>
The memcpy_fromio() function should have a const qualifier on its source pointer.
---
include/asm-frv/io.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-frv/io.h +1 -1
@@ -117,7 +117,7 @@ static inline void memset_io(volatile vomemset ((void __force *) addr, val, count); } -static inline void memcpy_fromio (void *dst,volatile void __iomem *src,int count) +static inline void memcpy_fromio (void *dst,const volatile void __iomem *src,int count) {memcpy (dst, (void __force *) src, count); }
PATCH 14/15 frv: trivial cleanups in frv_ksyms.c
In reply to David HowellsFrom: Al Viro <[email protected]>
Remove duplicate EXPORT_SYMBOL annotations from the FRV arch.
---
arch/frv/kernel/frv_ksyms.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
arch/frv/kernel/frv_ksyms.c +0 -18
@@ -26,16 +26,6 @@ extern long __memset_user(void *dst, conEXPORT_SYMBOL (__ioremap);EXPORT_SYMBOL (iounmap); -EXPORT_SYMBOL (strnlen); -EXPORT_SYMBOL (strrchr); -EXPORT_SYMBOL (strstr); -EXPORT_SYMBOL (strchr); -EXPORT_SYMBOL (strcat); -EXPORT_SYMBOL (strlen); -EXPORT_SYMBOL (strcmp); -EXPORT_SYMBOL (strncmp); -EXPORT_SYMBOL (strncpy); -EXPORT_SYMBOL (ip_fast_csum);#if 0
@@ -44,8 +34,6 @@ EXPORT_SYMBOL(local_bh_count);#endif EXPORT_SYMBOL (kernel_thread); -EXPORT_SYMBOL (enable_irq); -EXPORT_SYMBOL (disable_irq);EXPORT_SYMBOL (__res_bus_clock_speed_HZ);EXPORT_SYMBOL (__page_offset);EXPORT_SYMBOL (__memcpy_user);
@@ -62,18 +50,12 @@ #endifEXPORT_SYMBOL (__debug_bug_trap); -/* Networking helper routines. */ -EXPORT_SYMBOL (csum_partial_copy); -/* The following are special because they're not called explicitly (the C compiler generates them). Fortunately, their interface isn't gonna change any time soon now, so it's OK to leave it out of version control. */ EXPORT_SYMBOL (memcpy);EXPORT_SYMBOL (memset); -EXPORT_SYMBOL (memcmp); -EXPORT_SYMBOL (memscan); -EXPORT_SYMBOL (memmove);EXPORT_SYMBOL (__outsl_ns);EXPORT_SYMBOL (__insl_ns);
PATCH 15/15 frv: clean frv unistd.h
In reply to David HowellsFrom: Al Viro <[email protected]>
Remove _syscall invocations that aren't used in the kernel.
---
include/asm-frv/unistd.h | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-)
include/asm-frv/unistd.h +0 -17
@@ -458,24 +458,7 @@ #include <asm/ptrace.h>* some others too. */ #define __NR__exit __NR_exit -static inline _syscall0(int,pause) -static inline _syscall0 (int ,sync ) -static inline_syscall0 (pid_t,setsid) -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) -static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) -static inline_syscall3 (off_t,lseek,int,fd,off_t,offset,int,count) -static inline_syscall1 (int,dup,int,fd) static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) -static inline _syscall3(int,open,const char *,file,int,flag,int,mode) -static inline_syscall1 (int,close,int,fd) -static inline_syscall1 (int,_exit,int,exitcode) -static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) -static inline _syscall1(int,delete_module,const char *,name) - -static inline pid_twait (int * wait_stat) -{ -return waitpid (-1 ,wait_stat,0 ); -}#endif
Re: [PATCH 15/15] frv: clean frv unistd.h
Quoted 6 lines · David Howells
From: Al Viro <[email protected]>
Remove
_syscallinvocations that aren't used in the kernel.Signed-off-by Al Viro <[email protected]>Signed-off-by David Howells <[email protected]>
In that case, you might as well remove the definitions of _syscall0, _syscall1, etc. too. Nothing uses them now at all, does it?
Signature · 1 line
dwmw2