Commit 20ca5ae1 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Add user pointer annotations to core sysctl files.

parent 6b5cbfd9
...@@ -36,11 +36,11 @@ struct file; ...@@ -36,11 +36,11 @@ struct file;
member of a struct __sysctl_args to have? */ member of a struct __sysctl_args to have? */
struct __sysctl_args { struct __sysctl_args {
int *name; int __user *name;
int nlen; int nlen;
void *oldval; void __user *oldval;
size_t *oldlenp; size_t __user *oldlenp;
void *newval; void __user *newval;
size_t newlen; size_t newlen;
unsigned long __unused[4]; unsigned long __unused[4];
}; };
...@@ -674,40 +674,40 @@ enum ...@@ -674,40 +674,40 @@ enum
#ifdef __KERNEL__ #ifdef __KERNEL__
extern asmlinkage long sys_sysctl(struct __sysctl_args *); extern asmlinkage long sys_sysctl(struct __sysctl_args __user *);
extern void sysctl_init(void); extern void sysctl_init(void);
typedef struct ctl_table ctl_table; typedef struct ctl_table ctl_table;
typedef int ctl_handler (ctl_table *table, int *name, int nlen, typedef int ctl_handler (ctl_table *table, int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void __user *newval, size_t newlen,
void **context); void **context);
typedef int proc_handler (ctl_table *ctl, int write, struct file * filp, typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
void *buffer, size_t *lenp); void __user *buffer, size_t *lenp);
extern int proc_dostring(ctl_table *, int, struct file *, extern int proc_dostring(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_dointvec(ctl_table *, int, struct file *, extern int proc_dointvec(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_dointvec_bset(ctl_table *, int, struct file *, extern int proc_dointvec_bset(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_dointvec_minmax(ctl_table *, int, struct file *, extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_dointvec_jiffies(ctl_table *, int, struct file *, extern int proc_dointvec_jiffies(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_doulongvec_minmax(ctl_table *, int, struct file *, extern int proc_doulongvec_minmax(ctl_table *, int, struct file *,
void *, size_t *); void __user *, size_t *);
extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int, extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int,
struct file *, void *, size_t *); struct file *, void __user *, size_t *);
extern int do_sysctl (int *name, int nlen, extern int do_sysctl (int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen); void __user *newval, size_t newlen);
extern int do_sysctl_strategy (ctl_table *table, extern int do_sysctl_strategy (ctl_table *table,
int *name, int nlen, int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void ** context); void __user *newval, size_t newlen, void ** context);
......
...@@ -103,10 +103,10 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp, ...@@ -103,10 +103,10 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
extern int acct_parm[]; extern int acct_parm[];
#endif #endif
static int parse_table(int *, int, void *, size_t *, void *, size_t, static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
ctl_table *, void **); ctl_table *, void **);
static int proc_doutsstring(ctl_table *table, int write, struct file *filp, static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp); void __user *buffer, size_t *lenp);
static ctl_table root_table[]; static ctl_table root_table[];
static struct ctl_table_header root_table_header = static struct ctl_table_header root_table_header =
...@@ -127,8 +127,8 @@ extern ctl_table random_table[]; ...@@ -127,8 +127,8 @@ extern ctl_table random_table[];
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static ssize_t proc_readsys(struct file *, char *, size_t, loff_t *); static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
static ssize_t proc_writesys(struct file *, const char *, size_t, loff_t *); static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
static int proc_sys_permission(struct inode *, int); static int proc_sys_permission(struct inode *, int);
struct file_operations proc_sys_file_operations = { struct file_operations proc_sys_file_operations = {
...@@ -374,8 +374,8 @@ void __init sysctl_init(void) ...@@ -374,8 +374,8 @@ void __init sysctl_init(void)
#endif #endif
} }
int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen) void __user *newval, size_t newlen)
{ {
struct list_head *tmp; struct list_head *tmp;
...@@ -443,7 +443,7 @@ static inline int ctl_perm(ctl_table *table, int op) ...@@ -443,7 +443,7 @@ static inline int ctl_perm(ctl_table *table, int op)
return test_perm(table->mode, op); return test_perm(table->mode, op);
} }
static int parse_table(int *name, int nlen, static int parse_table(int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void __user *newval, size_t newlen,
ctl_table *table, void **context) ctl_table *table, void **context)
...@@ -484,7 +484,7 @@ static int parse_table(int *name, int nlen, ...@@ -484,7 +484,7 @@ static int parse_table(int *name, int nlen,
/* Perform the actual read/write of a sysctl table entry. */ /* Perform the actual read/write of a sysctl table entry. */
int do_sysctl_strategy (ctl_table *table, int do_sysctl_strategy (ctl_table *table,
int *name, int nlen, int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
...@@ -721,7 +721,7 @@ static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root ...@@ -721,7 +721,7 @@ static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root
} }
} }
static ssize_t do_rw_proc(int write, struct file * file, char * buf, static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int op; int op;
...@@ -752,16 +752,16 @@ static ssize_t do_rw_proc(int write, struct file * file, char * buf, ...@@ -752,16 +752,16 @@ static ssize_t do_rw_proc(int write, struct file * file, char * buf,
return res; return res;
} }
static ssize_t proc_readsys(struct file * file, char * buf, static ssize_t proc_readsys(struct file * file, char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
return do_rw_proc(0, file, buf, count, ppos); return do_rw_proc(0, file, buf, count, ppos);
} }
static ssize_t proc_writesys(struct file * file, const char * buf, static ssize_t proc_writesys(struct file * file, const char __user * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
return do_rw_proc(1, file, (char *) buf, count, ppos); return do_rw_proc(1, file, (char __user *) buf, count, ppos);
} }
static int proc_sys_permission(struct inode *inode, int op) static int proc_sys_permission(struct inode *inode, int op)
...@@ -1345,7 +1345,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, ...@@ -1345,7 +1345,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
*/ */
/* The generic string strategy routine: */ /* The generic string strategy routine: */
int sysctl_string(ctl_table *table, int *name, int nlen, int sysctl_string(ctl_table *table, int __user *name, int nlen,
void __user *oldval, size_t __user *oldlenp, void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
...@@ -1388,9 +1388,9 @@ int sysctl_string(ctl_table *table, int *name, int nlen, ...@@ -1388,9 +1388,9 @@ int sysctl_string(ctl_table *table, int *name, int nlen,
* are between the minimum and maximum values given in the arrays * are between the minimum and maximum values given in the arrays
* table->extra1 and table->extra2, respectively. * table->extra1 and table->extra2, respectively.
*/ */
int sysctl_intvec(ctl_table *table, int *name, int nlen, int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
int i, *vec, *min, *max; int i, *vec, *min, *max;
size_t length; size_t length;
...@@ -1423,9 +1423,9 @@ int sysctl_intvec(ctl_table *table, int *name, int nlen, ...@@ -1423,9 +1423,9 @@ int sysctl_intvec(ctl_table *table, int *name, int nlen,
} }
/* Strategy function to convert jiffies to seconds */ /* Strategy function to convert jiffies to seconds */
int sysctl_jiffies(ctl_table *table, int *name, int nlen, int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
if (oldval) { if (oldval) {
size_t olen; size_t olen;
...@@ -1459,47 +1459,47 @@ extern asmlinkage long sys_sysctl(struct __sysctl_args __user *args) ...@@ -1459,47 +1459,47 @@ extern asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
return -ENOSYS; return -ENOSYS;
} }
int sysctl_string(ctl_table *table, int *name, int nlen, int sysctl_string(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
return -ENOSYS; return -ENOSYS;
} }
int sysctl_intvec(ctl_table *table, int *name, int nlen, int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
return -ENOSYS; return -ENOSYS;
} }
int sysctl_jiffies(ctl_table *table, int *name, int nlen, int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
return -ENOSYS; return -ENOSYS;
} }
int proc_dostring(ctl_table *table, int write, struct file *filp, int proc_dostring(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
int proc_dointvec(ctl_table *table, int write, struct file *filp, int proc_dointvec(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
int proc_dointvec_bset(ctl_table *table, int write, struct file *filp, int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp, int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
...@@ -1511,14 +1511,14 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp, ...@@ -1511,14 +1511,14 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
} }
int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp, int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
struct file *filp, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
return -ENOSYS; return -ENOSYS;
} }
......
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