diff options
Diffstat (limited to 'net/bridge/netfilter/ebtables.c')
| -rw-r--r-- | net/bridge/netfilter/ebtables.c | 22 | 
1 files changed, 10 insertions, 12 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index ac780242838..1059ed3bc25 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -118,10 +118,10 @@ ebt_dev_check(const char *entry, const struct net_device *device)  	/* 1 is the wildcard token */  	while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i])  		i++; -	return (devname[i] != entry[i] && entry[i] != 1); +	return devname[i] != entry[i] && entry[i] != 1;  } -#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg)) +#define FWINV2(bool, invflg) ((bool) ^ !!(e->invflags & invflg))  /* process standard matches */  static inline int  ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb, @@ -1044,10 +1044,9 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,  	if (repl->num_counters &&  	   copy_to_user(repl->counters, counterstmp,  	   repl->num_counters * sizeof(struct ebt_counter))) { -		ret = -EFAULT; +		/* Silent error, can't fail, new table is already in place */ +		net_warn_ratelimited("ebtables: counters copy to user failed while replacing table\n");  	} -	else -		ret = 0;  	/* decrease module count and free resources */  	EBT_ENTRY_ITERATE(table->entries, table->entries_size, @@ -1441,7 +1440,7 @@ static int copy_everything_to_user(struct ebt_table *t, void __user *user,  		return -EFAULT;  	if (*len != sizeof(struct ebt_replace) + entries_size + -	   (tmp.num_counters? nentries * sizeof(struct ebt_counter): 0)) +	   (tmp.num_counters ? nentries * sizeof(struct ebt_counter) : 0))  		return -EINVAL;  	if (tmp.nentries != nentries) { @@ -1477,7 +1476,7 @@ static int do_ebt_set_ctl(struct sock *sk,  	if (!ns_capable(net->user_ns, CAP_NET_ADMIN))  		return -EPERM; -	switch(cmd) { +	switch (cmd) {  	case EBT_SO_SET_ENTRIES:  		ret = do_replace(net, user, len);  		break; @@ -1507,10 +1506,10 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)  	if (!t)  		return ret; -	switch(cmd) { +	switch (cmd) {  	case EBT_SO_GET_INFO:  	case EBT_SO_GET_INIT_INFO: -		if (*len != sizeof(struct ebt_replace)){ +		if (*len != sizeof(struct ebt_replace)) {  			ret = -EINVAL;  			mutex_unlock(&ebt_mutex);  			break; @@ -1525,7 +1524,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)  			tmp.valid_hooks = t->table->valid_hooks;  		}  		mutex_unlock(&ebt_mutex); -		if (copy_to_user(user, &tmp, *len) != 0){ +		if (copy_to_user(user, &tmp, *len) != 0) {  			BUGPRINT("c2u Didn't work\n");  			ret = -EFAULT;  			break; @@ -2375,8 +2374,7 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,  }  #endif -static struct nf_sockopt_ops ebt_sockopts = -{ +static struct nf_sockopt_ops ebt_sockopts = {  	.pf		= PF_INET,  	.set_optmin	= EBT_BASE_CTL,  	.set_optmax	= EBT_SO_SET_MAX + 1,  | 
