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

[PATCH] frv: sysctl __user annotations

Add __user annotations to FRV-specific sysctl stuff.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Al Viro and committed by
Linus Torvalds
7ab76d72 9e4d11f8

+22 -22
+20 -20
arch/frv/kernel/pm.c
··· 137 137 #define CTL_PM_P0 4 138 138 #define CTL_PM_CM 5 139 139 140 - static int user_atoi(char *ubuf, size_t len) 140 + static int user_atoi(char __user *ubuf, size_t len) 141 141 { 142 142 char buf[16]; 143 143 unsigned long ret; ··· 159 159 * Send us to sleep. 160 160 */ 161 161 static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp, 162 - void *buffer, size_t *lenp, loff_t *fpos) 162 + void __user *buffer, size_t *lenp, loff_t *fpos) 163 163 { 164 164 int retval, mode; 165 165 ··· 215 215 216 216 217 217 static int cmode_procctl(ctl_table *ctl, int write, struct file *filp, 218 - void *buffer, size_t *lenp, loff_t *fpos) 218 + void __user *buffer, size_t *lenp, loff_t *fpos) 219 219 { 220 220 int new_cmode; 221 221 ··· 227 227 return try_set_cmode(new_cmode)?:*lenp; 228 228 } 229 229 230 - static int cmode_sysctl(ctl_table *table, int *name, int nlen, 231 - void *oldval, size_t *oldlenp, 232 - void *newval, size_t newlen, void **context) 230 + static int cmode_sysctl(ctl_table *table, int __user *name, int nlen, 231 + void __user *oldval, size_t __user *oldlenp, 232 + void __user *newval, size_t newlen, void **context) 233 233 { 234 234 if (oldval && oldlenp) { 235 235 size_t oldlen; ··· 240 240 if (oldlen != sizeof(int)) 241 241 return -EINVAL; 242 242 243 - if (put_user(clock_cmode_current, (unsigned int *)oldval) || 243 + if (put_user(clock_cmode_current, (unsigned __user *)oldval) || 244 244 put_user(sizeof(int), oldlenp)) 245 245 return -EFAULT; 246 246 } ··· 250 250 if (newlen != sizeof(int)) 251 251 return -EINVAL; 252 252 253 - if (get_user(new_cmode, (int *)newval)) 253 + if (get_user(new_cmode, (int __user *)newval)) 254 254 return -EFAULT; 255 255 256 256 return try_set_cmode(new_cmode)?:1; ··· 318 318 } 319 319 320 320 static int p0_procctl(ctl_table *ctl, int write, struct file *filp, 321 - void *buffer, size_t *lenp, loff_t *fpos) 321 + void __user *buffer, size_t *lenp, loff_t *fpos) 322 322 { 323 323 int new_p0; 324 324 ··· 330 330 return try_set_p0(new_p0)?:*lenp; 331 331 } 332 332 333 - static int p0_sysctl(ctl_table *table, int *name, int nlen, 334 - void *oldval, size_t *oldlenp, 335 - void *newval, size_t newlen, void **context) 333 + static int p0_sysctl(ctl_table *table, int __user *name, int nlen, 334 + void __user *oldval, size_t __user *oldlenp, 335 + void __user *newval, size_t newlen, void **context) 336 336 { 337 337 if (oldval && oldlenp) { 338 338 size_t oldlen; ··· 343 343 if (oldlen != sizeof(int)) 344 344 return -EINVAL; 345 345 346 - if (put_user(clock_p0_current, (unsigned int *)oldval) || 346 + if (put_user(clock_p0_current, (unsigned __user *)oldval) || 347 347 put_user(sizeof(int), oldlenp)) 348 348 return -EFAULT; 349 349 } ··· 353 353 if (newlen != sizeof(int)) 354 354 return -EINVAL; 355 355 356 - if (get_user(new_p0, (int *)newval)) 356 + if (get_user(new_p0, (int __user *)newval)) 357 357 return -EFAULT; 358 358 359 359 return try_set_p0(new_p0)?:1; ··· 362 362 } 363 363 364 364 static int cm_procctl(ctl_table *ctl, int write, struct file *filp, 365 - void *buffer, size_t *lenp, loff_t *fpos) 365 + void __user *buffer, size_t *lenp, loff_t *fpos) 366 366 { 367 367 int new_cm; 368 368 ··· 374 374 return try_set_cm(new_cm)?:*lenp; 375 375 } 376 376 377 - static int cm_sysctl(ctl_table *table, int *name, int nlen, 378 - void *oldval, size_t *oldlenp, 379 - void *newval, size_t newlen, void **context) 377 + static int cm_sysctl(ctl_table *table, int __user *name, int nlen, 378 + void __user *oldval, size_t __user *oldlenp, 379 + void __user *newval, size_t newlen, void **context) 380 380 { 381 381 if (oldval && oldlenp) { 382 382 size_t oldlen; ··· 387 387 if (oldlen != sizeof(int)) 388 388 return -EINVAL; 389 389 390 - if (put_user(clock_cm_current, (unsigned int *)oldval) || 390 + if (put_user(clock_cm_current, (unsigned __user *)oldval) || 391 391 put_user(sizeof(int), oldlenp)) 392 392 return -EFAULT; 393 393 } ··· 397 397 if (newlen != sizeof(int)) 398 398 return -EINVAL; 399 399 400 - if (get_user(new_cm, (int *)newval)) 400 + if (get_user(new_cm, (int __user *)newval)) 401 401 return -EFAULT; 402 402 403 403 return try_set_cm(new_cm)?:1;
+2 -2
arch/frv/kernel/sysctl.c
··· 49 49 * handle requests to dynamically switch the write caching mode delivered by /proc 50 50 */ 51 51 static int procctl_frv_cachemode(ctl_table *table, int write, struct file *filp, 52 - void *buffer, size_t *lenp, loff_t *ppos) 52 + void __user *buffer, size_t *lenp, loff_t *ppos) 53 53 { 54 54 unsigned long hsr0; 55 55 char buff[8]; ··· 123 123 */ 124 124 #ifdef CONFIG_MMU 125 125 static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp, 126 - void *buffer, size_t *lenp, loff_t *ppos) 126 + void __user *buffer, size_t *lenp, loff_t *ppos) 127 127 { 128 128 pid_t pid; 129 129 char buff[16], *p;