diff options
author | Shan Wei <shanwei@cn.fujitsu.com> | 2011-03-06 21:11:34 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-03-14 20:36:49 -0400 |
commit | 6060c74a3de8ed142c78133e2829e74711f77387 (patch) | |
tree | f8c9ee782481774229e3e92df3b77021238e65c2 /net/netfilter | |
parent | 4a569c0c0f833adace1e3aadaa38780ec2fcdf9e (diff) |
netfilter:ipvs: use kmemdup
The semantic patch that makes this output is available
in scripts/coccinelle/api/memdup.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_pe_sip.c | 9 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c index 0d83bc01fed4..13d607ae9c52 100644 --- a/net/netfilter/ipvs/ip_vs_pe_sip.c +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c | |||
@@ -92,14 +92,13 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) | |||
92 | if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen)) | 92 | if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen)) |
93 | return -EINVAL; | 93 | return -EINVAL; |
94 | 94 | ||
95 | p->pe_data = kmalloc(matchlen, GFP_ATOMIC); | ||
96 | if (!p->pe_data) | ||
97 | return -ENOMEM; | ||
98 | |||
99 | /* N.B: pe_data is only set on success, | 95 | /* N.B: pe_data is only set on success, |
100 | * this allows fallback to the default persistence logic on failure | 96 | * this allows fallback to the default persistence logic on failure |
101 | */ | 97 | */ |
102 | memcpy(p->pe_data, dptr + matchoff, matchlen); | 98 | p->pe_data = kmemdup(dptr + matchoff, matchlen, GFP_ATOMIC); |
99 | if (!p->pe_data) | ||
100 | return -ENOMEM; | ||
101 | |||
103 | p->pe_data_len = matchlen; | 102 | p->pe_data_len = matchlen; |
104 | 103 | ||
105 | return 0; | 104 | return 0; |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index fecf24de4af3..c5d13b05275a 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -697,13 +697,12 @@ ip_vs_conn_fill_param_sync(struct net *net, int af, union ip_vs_sync_conn *sc, | |||
697 | return 1; | 697 | return 1; |
698 | } | 698 | } |
699 | 699 | ||
700 | p->pe_data = kmalloc(pe_data_len, GFP_ATOMIC); | 700 | p->pe_data = kmemdup(pe_data, pe_data_len, GFP_ATOMIC); |
701 | if (!p->pe_data) { | 701 | if (!p->pe_data) { |
702 | if (p->pe->module) | 702 | if (p->pe->module) |
703 | module_put(p->pe->module); | 703 | module_put(p->pe->module); |
704 | return -ENOMEM; | 704 | return -ENOMEM; |
705 | } | 705 | } |
706 | memcpy(p->pe_data, pe_data, pe_data_len); | ||
707 | p->pe_data_len = pe_data_len; | 706 | p->pe_data_len = pe_data_len; |
708 | } | 707 | } |
709 | return 0; | 708 | return 0; |