From: Pekka Enberg Date: Mon, 9 Jun 2008 22:58:39 +0000 (-0700) Subject: netfilter: nf_conntrack_extend: use krealloc() in nf_conntrack_extend.c V2 X-Git-Tag: v2.6.27-rc1~964^2~344 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31d8519c9cf87e9d8a0cc5b9734fda02af66d7e2;p=profile%2Fivi%2Fkernel-x86-ivi.git netfilter: nf_conntrack_extend: use krealloc() in nf_conntrack_extend.c V2 The ksize() API is going away because it is being abused and it doesn't even work consistenly across different allocators. Therefore, convert net/netfilter/nf_conntrack_extend.c to use krealloc(). Signed-off-by: Pekka Enberg Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index bcc19fa..ba1c491 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c @@ -88,13 +88,11 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) newlen = newoff + t->len; rcu_read_unlock(); - if (newlen >= ksize(ct->ext)) { - new = kmalloc(newlen, gfp); - if (!new) - return NULL; - - memcpy(new, ct->ext, ct->ext->len); + new = krealloc(ct->ext, newlen, gfp); + if (!new) + return NULL; + if (new != ct->ext) { for (i = 0; i < NF_CT_EXT_NUM; i++) { if (!nf_ct_ext_exist(ct, i)) continue;