Commit bf205ac1 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: nf_sockopt() annotation

	netfilter set/getsockopt annotated.  That's a continuation of previous
patch - by now the only remaining place where setsockopt()/getsockopt()
userland pointers are not traced is vcc_[sg]etsockopt() and down into the
ATM drivers.  Everything from that area in net/* should be done by now.

	That's pretty much it as far as non-trivial splitting counts; remaining
patches in net/* are independent, tty and console stuff is also not hard to
split (not much of it, anyway) and what remains is arch-dependent code for
alpha and amd64.  Of course there'll be more stuff coming, but as far as I'm
concerned the rest of my pile is managable - and finally below 200Kb.  That'll
go tomorrow - right now I'm going down and getting some sleep...
parent 795d1215
...@@ -64,11 +64,11 @@ struct nf_sockopt_ops ...@@ -64,11 +64,11 @@ struct nf_sockopt_ops
/* Non-inclusive ranges: use 0/0/NULL to never get called. */ /* Non-inclusive ranges: use 0/0/NULL to never get called. */
int set_optmin; int set_optmin;
int set_optmax; int set_optmax;
int (*set)(struct sock *sk, int optval, void *user, unsigned int len); int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
int get_optmin; int get_optmin;
int get_optmax; int get_optmax;
int (*get)(struct sock *sk, int optval, void *user, int *len); int (*get)(struct sock *sk, int optval, void __user *user, int *len);
/* Number of users inside set() or get(). */ /* Number of users inside set() or get(). */
unsigned int use; unsigned int use;
...@@ -156,9 +156,9 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, ...@@ -156,9 +156,9 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
int (*okfn)(struct sk_buff *), int thresh); int (*okfn)(struct sk_buff *), int thresh);
/* Call setsockopt() */ /* Call setsockopt() */
int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt, int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
int len); int len);
int nf_getsockopt(struct sock *sk, int pf, int optval, char *opt, int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
int *len); int *len);
/* Packet queuing */ /* Packet queuing */
......
...@@ -902,7 +902,7 @@ static void get_counters(struct ebt_counter *oldcounters, ...@@ -902,7 +902,7 @@ static void get_counters(struct ebt_counter *oldcounters,
} }
/* replace the table */ /* replace the table */
static int do_replace(void *user, unsigned int len) static int do_replace(void __user *user, unsigned int len)
{ {
int ret, i, countersize; int ret, i, countersize;
struct ebt_table_info *newinfo; struct ebt_table_info *newinfo;
...@@ -1217,7 +1217,7 @@ void ebt_unregister_table(struct ebt_table *table) ...@@ -1217,7 +1217,7 @@ void ebt_unregister_table(struct ebt_table *table)
} }
/* userspace just supplied us with counters */ /* userspace just supplied us with counters */
static int update_counters(void *user, unsigned int len) static int update_counters(void __user *user, unsigned int len)
{ {
int i, ret; int i, ret;
struct ebt_counter *tmp; struct ebt_counter *tmp;
...@@ -1315,7 +1315,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char *ubase) ...@@ -1315,7 +1315,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char *ubase)
} }
/* called with ebt_mutex down */ /* called with ebt_mutex down */
static int copy_everything_to_user(struct ebt_table *t, void *user, static int copy_everything_to_user(struct ebt_table *t, void __user *user,
int *len, int cmd) int *len, int cmd)
{ {
struct ebt_replace tmp; struct ebt_replace tmp;
...@@ -1391,7 +1391,7 @@ static int copy_everything_to_user(struct ebt_table *t, void *user, ...@@ -1391,7 +1391,7 @@ static int copy_everything_to_user(struct ebt_table *t, void *user,
} }
static int do_ebt_set_ctl(struct sock *sk, static int do_ebt_set_ctl(struct sock *sk,
int cmd, void *user, unsigned int len) int cmd, void __user *user, unsigned int len)
{ {
int ret; int ret;
...@@ -1408,7 +1408,7 @@ static int do_ebt_set_ctl(struct sock *sk, ...@@ -1408,7 +1408,7 @@ static int do_ebt_set_ctl(struct sock *sk,
return ret; return ret;
} }
static int do_ebt_get_ctl(struct sock *sk, int cmd, void *user, int *len) static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
{ {
int ret; int ret;
struct ebt_replace tmp; struct ebt_replace tmp;
......
...@@ -286,7 +286,7 @@ void nf_debug_ip_finish_output2(struct sk_buff *skb) ...@@ -286,7 +286,7 @@ void nf_debug_ip_finish_output2(struct sk_buff *skb)
/* Call get/setsockopt() */ /* Call get/setsockopt() */
static int nf_sockopt(struct sock *sk, int pf, int val, static int nf_sockopt(struct sock *sk, int pf, int val,
char *opt, int *len, int get) char __user *opt, int *len, int get)
{ {
struct list_head *i; struct list_head *i;
struct nf_sockopt_ops *ops; struct nf_sockopt_ops *ops;
...@@ -329,13 +329,13 @@ static int nf_sockopt(struct sock *sk, int pf, int val, ...@@ -329,13 +329,13 @@ static int nf_sockopt(struct sock *sk, int pf, int val,
return ret; return ret;
} }
int nf_setsockopt(struct sock *sk, int pf, int val, char *opt, int nf_setsockopt(struct sock *sk, int pf, int val, char __user *opt,
int len) int len)
{ {
return nf_sockopt(sk, pf, val, opt, &len, 0); return nf_sockopt(sk, pf, val, opt, &len, 0);
} }
int nf_getsockopt(struct sock *sk, int pf, int val, char *opt, int *len) int nf_getsockopt(struct sock *sk, int pf, int val, char __user *opt, int *len)
{ {
return nf_sockopt(sk, pf, val, opt, len, 1); return nf_sockopt(sk, pf, val, opt, len, 1);
} }
......
...@@ -1912,7 +1912,7 @@ static unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = { ...@@ -1912,7 +1912,7 @@ static unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = {
}; };
static int static int
do_ip_vs_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
{ {
int ret; int ret;
unsigned char arg[MAX_ARG_LEN]; unsigned char arg[MAX_ARG_LEN];
......
...@@ -778,7 +778,7 @@ static void get_counters(const struct arpt_table_info *t, ...@@ -778,7 +778,7 @@ static void get_counters(const struct arpt_table_info *t,
static int copy_entries_to_user(unsigned int total_size, static int copy_entries_to_user(unsigned int total_size,
struct arpt_table *table, struct arpt_table *table,
void *userptr) void __user *userptr)
{ {
unsigned int off, num, countersize; unsigned int off, num, countersize;
struct arpt_entry *e; struct arpt_entry *e;
...@@ -838,7 +838,7 @@ static int copy_entries_to_user(unsigned int total_size, ...@@ -838,7 +838,7 @@ static int copy_entries_to_user(unsigned int total_size,
} }
static int get_entries(const struct arpt_get_entries *entries, static int get_entries(const struct arpt_get_entries *entries,
struct arpt_get_entries *uptr) struct arpt_get_entries __user *uptr)
{ {
int ret; int ret;
struct arpt_table *t; struct arpt_table *t;
...@@ -864,7 +864,7 @@ static int get_entries(const struct arpt_get_entries *entries, ...@@ -864,7 +864,7 @@ static int get_entries(const struct arpt_get_entries *entries,
return ret; return ret;
} }
static int do_replace(void *user, unsigned int len) static int do_replace(void __user *user, unsigned int len)
{ {
int ret; int ret;
struct arpt_replace tmp; struct arpt_replace tmp;
...@@ -980,7 +980,7 @@ static inline int add_counter_to_entry(struct arpt_entry *e, ...@@ -980,7 +980,7 @@ static inline int add_counter_to_entry(struct arpt_entry *e,
return 0; return 0;
} }
static int do_add_counters(void *user, unsigned int len) static int do_add_counters(void __user *user, unsigned int len)
{ {
unsigned int i; unsigned int i;
struct arpt_counters_info tmp, *paddc; struct arpt_counters_info tmp, *paddc;
...@@ -1027,7 +1027,7 @@ static int do_add_counters(void *user, unsigned int len) ...@@ -1027,7 +1027,7 @@ static int do_add_counters(void *user, unsigned int len)
return ret; return ret;
} }
static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
{ {
int ret; int ret;
...@@ -1051,7 +1051,7 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int le ...@@ -1051,7 +1051,7 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int le
return ret; return ret;
} }
static int do_arpt_get_ctl(struct sock *sk, int cmd, void *user, int *len) static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
{ {
int ret; int ret;
......
...@@ -1300,7 +1300,7 @@ ip_ct_selective_cleanup(int (*kill)(const struct ip_conntrack *i, void *data), ...@@ -1300,7 +1300,7 @@ ip_ct_selective_cleanup(int (*kill)(const struct ip_conntrack *i, void *data),
/* Reversing the socket's dst/src point of view gives us the reply /* Reversing the socket's dst/src point of view gives us the reply
mapping. */ mapping. */
static int static int
getorigdst(struct sock *sk, int optval, void *user, int *len) getorigdst(struct sock *sk, int optval, void __user *user, int *len)
{ {
struct inet_opt *inet = inet_sk(sk); struct inet_opt *inet = inet_sk(sk);
struct ip_conntrack_tuple_hash *h; struct ip_conntrack_tuple_hash *h;
......
...@@ -181,7 +181,7 @@ static unsigned int fw_confirm(unsigned int hooknum, ...@@ -181,7 +181,7 @@ static unsigned int fw_confirm(unsigned int hooknum,
extern int ip_fw_ctl(int optval, void *m, unsigned int len); extern int ip_fw_ctl(int optval, void *m, unsigned int len);
static int sock_fn(struct sock *sk, int optval, void *user, unsigned int len) static int sock_fn(struct sock *sk, int optval, void __user *user, unsigned int len)
{ {
/* MAX of: /* MAX of:
2.2: sizeof(struct ip_fwtest) (~14x4 + 3x4 = 17x4) 2.2: sizeof(struct ip_fwtest) (~14x4 + 3x4 = 17x4)
......
...@@ -942,7 +942,7 @@ get_counters(const struct ipt_table_info *t, ...@@ -942,7 +942,7 @@ get_counters(const struct ipt_table_info *t,
static int static int
copy_entries_to_user(unsigned int total_size, copy_entries_to_user(unsigned int total_size,
struct ipt_table *table, struct ipt_table *table,
void *userptr) void __user *userptr)
{ {
unsigned int off, num, countersize; unsigned int off, num, countersize;
struct ipt_entry *e; struct ipt_entry *e;
...@@ -1020,7 +1020,7 @@ copy_entries_to_user(unsigned int total_size, ...@@ -1020,7 +1020,7 @@ copy_entries_to_user(unsigned int total_size,
static int static int
get_entries(const struct ipt_get_entries *entries, get_entries(const struct ipt_get_entries *entries,
struct ipt_get_entries *uptr) struct ipt_get_entries __user *uptr)
{ {
int ret; int ret;
struct ipt_table *t; struct ipt_table *t;
...@@ -1047,7 +1047,7 @@ get_entries(const struct ipt_get_entries *entries, ...@@ -1047,7 +1047,7 @@ get_entries(const struct ipt_get_entries *entries,
} }
static int static int
do_replace(void *user, unsigned int len) do_replace(void __user *user, unsigned int len)
{ {
int ret; int ret;
struct ipt_replace tmp; struct ipt_replace tmp;
...@@ -1173,7 +1173,7 @@ add_counter_to_entry(struct ipt_entry *e, ...@@ -1173,7 +1173,7 @@ add_counter_to_entry(struct ipt_entry *e,
} }
static int static int
do_add_counters(void *user, unsigned int len) do_add_counters(void __user *user, unsigned int len)
{ {
unsigned int i; unsigned int i;
struct ipt_counters_info tmp, *paddc; struct ipt_counters_info tmp, *paddc;
...@@ -1221,7 +1221,7 @@ do_add_counters(void *user, unsigned int len) ...@@ -1221,7 +1221,7 @@ do_add_counters(void *user, unsigned int len)
} }
static int static int
do_ipt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
{ {
int ret; int ret;
...@@ -1246,7 +1246,7 @@ do_ipt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) ...@@ -1246,7 +1246,7 @@ do_ipt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len)
} }
static int static int
do_ipt_get_ctl(struct sock *sk, int cmd, void *user, int *len) do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
{ {
int ret; int ret;
......
...@@ -1106,7 +1106,7 @@ copy_entries_to_user(unsigned int total_size, ...@@ -1106,7 +1106,7 @@ copy_entries_to_user(unsigned int total_size,
static int static int
get_entries(const struct ip6t_get_entries *entries, get_entries(const struct ip6t_get_entries *entries,
struct ip6t_get_entries *uptr) struct ip6t_get_entries __user *uptr)
{ {
int ret; int ret;
struct ip6t_table *t; struct ip6t_table *t;
...@@ -1133,7 +1133,7 @@ get_entries(const struct ip6t_get_entries *entries, ...@@ -1133,7 +1133,7 @@ get_entries(const struct ip6t_get_entries *entries,
} }
static int static int
do_replace(void *user, unsigned int len) do_replace(void __user *user, unsigned int len)
{ {
int ret; int ret;
struct ip6t_replace tmp; struct ip6t_replace tmp;
...@@ -1254,7 +1254,7 @@ add_counter_to_entry(struct ip6t_entry *e, ...@@ -1254,7 +1254,7 @@ add_counter_to_entry(struct ip6t_entry *e,
} }
static int static int
do_add_counters(void *user, unsigned int len) do_add_counters(void __user *user, unsigned int len)
{ {
unsigned int i; unsigned int i;
struct ip6t_counters_info tmp, *paddc; struct ip6t_counters_info tmp, *paddc;
...@@ -1302,7 +1302,7 @@ do_add_counters(void *user, unsigned int len) ...@@ -1302,7 +1302,7 @@ do_add_counters(void *user, unsigned int len)
} }
static int static int
do_ip6t_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
{ {
int ret; int ret;
...@@ -1327,7 +1327,7 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len) ...@@ -1327,7 +1327,7 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len)
} }
static int static int
do_ip6t_get_ctl(struct sock *sk, int cmd, void *user, int *len) do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
{ {
int ret; int ret;
......
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