diff options
| author | Markus Elfring <elfring@users.sourceforge.net> | 2014-11-18 14:37:05 -0500 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-11-20 07:08:43 -0500 |
| commit | 982f405136a44754e884184d24b70d2d4cefcb7a (patch) | |
| tree | 859f3fc225ed106392df89500c2deac8de57326d /net/netfilter | |
| parent | 2c7b5d5dac0ddaa4e1109fb84dbbe91db3c6c6e5 (diff) | |
netfilter: Deletion of unnecessary checks before two function calls
The functions free_percpu() and module_put() test whether their argument
is NULL and then return immediately. Thus the test around the call is
not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 3 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_pe.c | 3 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_sched.c | 3 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 3 | ||||
| -rw-r--r-- | net/netfilter/nf_tables_api.c | 3 |
5 files changed, 5 insertions, 10 deletions
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index ac7ba689efe7..b8295a430a56 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -465,8 +465,7 @@ __ip_vs_bind_svc(struct ip_vs_dest *dest, struct ip_vs_service *svc) | |||
| 465 | 465 | ||
| 466 | static void ip_vs_service_free(struct ip_vs_service *svc) | 466 | static void ip_vs_service_free(struct ip_vs_service *svc) |
| 467 | { | 467 | { |
| 468 | if (svc->stats.cpustats) | 468 | free_percpu(svc->stats.cpustats); |
| 469 | free_percpu(svc->stats.cpustats); | ||
| 470 | kfree(svc); | 469 | kfree(svc); |
| 471 | } | 470 | } |
| 472 | 471 | ||
diff --git a/net/netfilter/ipvs/ip_vs_pe.c b/net/netfilter/ipvs/ip_vs_pe.c index 1a82b29ce8ea..0df17caa8af6 100644 --- a/net/netfilter/ipvs/ip_vs_pe.c +++ b/net/netfilter/ipvs/ip_vs_pe.c | |||
| @@ -37,8 +37,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name) | |||
| 37 | rcu_read_unlock(); | 37 | rcu_read_unlock(); |
| 38 | return pe; | 38 | return pe; |
| 39 | } | 39 | } |
| 40 | if (pe->module) | 40 | module_put(pe->module); |
| 41 | module_put(pe->module); | ||
| 42 | } | 41 | } |
| 43 | rcu_read_unlock(); | 42 | rcu_read_unlock(); |
| 44 | 43 | ||
diff --git a/net/netfilter/ipvs/ip_vs_sched.c b/net/netfilter/ipvs/ip_vs_sched.c index 4dbcda6258bc..199760c71f39 100644 --- a/net/netfilter/ipvs/ip_vs_sched.c +++ b/net/netfilter/ipvs/ip_vs_sched.c | |||
| @@ -104,8 +104,7 @@ static struct ip_vs_scheduler *ip_vs_sched_getbyname(const char *sched_name) | |||
| 104 | mutex_unlock(&ip_vs_sched_mutex); | 104 | mutex_unlock(&ip_vs_sched_mutex); |
| 105 | return sched; | 105 | return sched; |
| 106 | } | 106 | } |
| 107 | if (sched->module) | 107 | module_put(sched->module); |
| 108 | module_put(sched->module); | ||
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | mutex_unlock(&ip_vs_sched_mutex); | 110 | mutex_unlock(&ip_vs_sched_mutex); |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index 7162c86fd50d..c47ffd7a0a70 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
| @@ -820,8 +820,7 @@ ip_vs_conn_fill_param_sync(struct net *net, int af, union ip_vs_sync_conn *sc, | |||
| 820 | 820 | ||
| 821 | p->pe_data = kmemdup(pe_data, pe_data_len, GFP_ATOMIC); | 821 | p->pe_data = kmemdup(pe_data, pe_data_len, GFP_ATOMIC); |
| 822 | if (!p->pe_data) { | 822 | if (!p->pe_data) { |
| 823 | if (p->pe->module) | 823 | module_put(p->pe->module); |
| 824 | module_put(p->pe->module); | ||
| 825 | return -ENOMEM; | 824 | return -ENOMEM; |
| 826 | } | 825 | } |
| 827 | p->pe_data_len = pe_data_len; | 826 | p->pe_data_len = pe_data_len; |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 1ffb253c6a77..18a9daef22dd 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -3674,8 +3674,7 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
| 3674 | break; | 3674 | break; |
| 3675 | case NFT_MSG_NEWCHAIN: | 3675 | case NFT_MSG_NEWCHAIN: |
| 3676 | if (nft_trans_chain_update(trans)) { | 3676 | if (nft_trans_chain_update(trans)) { |
| 3677 | if (nft_trans_chain_stats(trans)) | 3677 | free_percpu(nft_trans_chain_stats(trans)); |
| 3678 | free_percpu(nft_trans_chain_stats(trans)); | ||
| 3679 | 3678 | ||
| 3680 | nft_trans_destroy(trans); | 3679 | nft_trans_destroy(trans); |
| 3681 | } else { | 3680 | } else { |
