Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PARISC] more sparse fixes

0/NULL changes, __user annotations, __iomem annotations

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

authored by

Matthew Wilcox and committed by
Kyle McMartin
e51ec241 c2c4798e

+34 -32
+13 -13
arch/parisc/hpux/fs.c
··· 35 35 int error; 36 36 char *filename; 37 37 38 - filename = getname((char *) regs->gr[26]); 38 + filename = getname((char __user *) regs->gr[26]); 39 39 error = PTR_ERR(filename); 40 40 if (IS_ERR(filename)) 41 41 goto out; 42 42 43 - error = do_execve(filename, (char **) regs->gr[25], 44 - (char **)regs->gr[24], regs); 43 + error = do_execve(filename, (char __user * __user *) regs->gr[25], 44 + (char __user * __user *) regs->gr[24], regs); 45 45 46 46 if (error == 0) { 47 47 task_lock(current); ··· 63 63 }; 64 64 65 65 struct getdents_callback { 66 - struct hpux_dirent *current_dir; 67 - struct hpux_dirent *previous; 66 + struct hpux_dirent __user *current_dir; 67 + struct hpux_dirent __user *previous; 68 68 int count; 69 69 int error; 70 70 }; 71 71 72 - #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) 72 + #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) 73 73 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) 74 74 75 75 static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 76 76 u64 ino, unsigned d_type) 77 77 { 78 - struct hpux_dirent * dirent; 78 + struct hpux_dirent __user * dirent; 79 79 struct getdents_callback * buf = (struct getdents_callback *) __buf; 80 80 ino_t d_ino; 81 81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); ··· 105 105 #undef NAME_OFFSET 106 106 #undef ROUND_UP 107 107 108 - int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count) 108 + int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) 109 109 { 110 110 struct file * file; 111 - struct hpux_dirent * lastdirent; 111 + struct hpux_dirent __user * lastdirent; 112 112 struct getdents_callback buf; 113 113 int error = -EBADF; 114 114 ··· 143 143 return -ENOSYS; 144 144 } 145 145 146 - static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf) 146 + static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf) 147 147 { 148 148 struct hpux_stat64 tmp; 149 149 ··· 169 169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 170 170 } 171 171 172 - long hpux_stat64(char *filename, struct hpux_stat64 *statbuf) 172 + long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf) 173 173 { 174 174 struct kstat stat; 175 175 int error = vfs_stat(filename, &stat); ··· 180 180 return error; 181 181 } 182 182 183 - long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf) 183 + long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf) 184 184 { 185 185 struct kstat stat; 186 186 int error = vfs_fstat(fd, &stat); ··· 191 191 return error; 192 192 } 193 193 194 - long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf) 194 + long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf) 195 195 { 196 196 struct kstat stat; 197 197 int error = vfs_lstat(filename, &stat);
+17 -15
arch/parisc/hpux/sys_hpux.c
··· 61 61 return -ENOSYS; 62 62 } 63 63 64 - int hpux_wait(int *stat_loc) 64 + int hpux_wait(int __user *stat_loc) 65 65 { 66 66 return sys_waitpid(-1, stat_loc, 0); 67 67 } ··· 255 255 /* TODO: Are these put_user calls OK? Should they pass an int? 256 256 * (I copied it from sys_i386.c like this.) 257 257 */ 258 - static int hpux_uname(struct hpux_utsname *name) 258 + static int hpux_uname(struct hpux_utsname __user *name) 259 259 { 260 260 int error; 261 261 ··· 300 300 /* Note: HP-UX just uses the old suser() function to check perms 301 301 * in this system call. We'll use capable(CAP_SYS_ADMIN). 302 302 */ 303 - int hpux_utssys(char *ubuf, int n, int type) 303 + int hpux_utssys(char __user *ubuf, int n, int type) 304 304 { 305 305 int len; 306 306 int error; 307 307 switch( type ) { 308 308 case 0: 309 309 /* uname(): */ 310 - return( hpux_uname( (struct hpux_utsname *)ubuf ) ); 310 + return hpux_uname((struct hpux_utsname __user *)ubuf); 311 311 break ; 312 312 case 1: 313 313 /* Obsolete (used to be umask().) */ ··· 315 315 break ; 316 316 case 2: 317 317 /* ustat(): */ 318 - return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) ); 319 - break ; 318 + return hpux_ustat(new_decode_dev(n), 319 + (struct hpux_ustat __user *)ubuf); 320 + break; 320 321 case 3: 321 322 /* setuname(): 322 323 * ··· 333 332 return -EINVAL ; 334 333 /* Unlike Linux, HP-UX truncates it if n is too big: */ 335 334 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 336 - return( sys_sethostname(ubuf, len) ); 335 + return sys_sethostname(ubuf, len); 337 336 break ; 338 337 case 4: 339 338 /* sethostname(): ··· 347 346 return -EINVAL ; 348 347 /* Unlike Linux, HP-UX truncates it if n is too big: */ 349 348 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 350 - return( sys_sethostname(ubuf, len) ); 349 + return sys_sethostname(ubuf, len); 351 350 break ; 352 351 case 5: 353 352 /* gethostname(): ··· 357 356 /* Unlike Linux, HP-UX returns an error if n==0: */ 358 357 if ( n <= 0 ) 359 358 return -EINVAL ; 360 - return( sys_gethostname(ubuf, n) ); 359 + return sys_gethostname(ubuf, n); 361 360 break ; 362 361 case 6: 363 362 /* Supposedly called from setuname() in libc. ··· 421 420 } 422 421 } 423 422 424 - int hpux_getdomainname(char *name, int len) 423 + int hpux_getdomainname(char __user *name, int len) 425 424 { 426 425 int nlen; 427 426 int err = -EFAULT; ··· 472 471 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1); 473 472 474 473 if ( opcode == 1 ) { /* GETFSIND */ 475 - len = strlen_user((char *)arg1); 474 + char __user *user_fsname = (char __user *)arg1; 475 + len = strlen_user(user_fsname); 476 476 printk(KERN_DEBUG "len of arg1 = %d\n", len); 477 477 if (len == 0) 478 478 return 0; 479 - fsname = (char *) kmalloc(len, GFP_KERNEL); 480 - if ( !fsname ) { 479 + fsname = kmalloc(len, GFP_KERNEL); 480 + if (!fsname) { 481 481 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 482 482 return 0; 483 483 } 484 484 485 - if ( copy_from_user(fsname, (char *)arg1, len) ) { 485 + if (copy_from_user(fsname, user_fsname, len)) { 486 486 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 487 487 kfree(fsname); 488 488 return 0; ··· 497 495 fstype = 0; 498 496 } else { 499 497 fstype = 0; 500 - }; 498 + } 501 499 502 500 kfree(fsname); 503 501
+1 -1
arch/parisc/kernel/pci-dma.c
··· 342 342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, 343 343 get_order(pcxl_res_size)); 344 344 memset(pcxl_res_map, 0, pcxl_res_size); 345 - proc_gsc_root = proc_mkdir("gsc", 0); 345 + proc_gsc_root = proc_mkdir("gsc", NULL); 346 346 if (!proc_gsc_root) 347 347 printk(KERN_WARNING 348 348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
+3 -3
arch/parisc/mm/ioremap.c
··· 128 128 */ 129 129 void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 130 130 { 131 - void *addr; 131 + void __iomem *addr; 132 132 struct vm_struct *area; 133 133 unsigned long offset, last_addr; 134 134 ··· 178 178 if (!area) 179 179 return NULL; 180 180 181 - addr = area->addr; 181 + addr = (void __iomem *) area->addr; 182 182 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 183 183 vfree(addr); 184 184 return NULL; 185 185 } 186 186 187 - return (void __iomem *) (offset + (char *)addr); 187 + return (void __iomem *) (offset + (char __iomem *)addr); 188 188 } 189 189 EXPORT_SYMBOL(__ioremap); 190 190