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 <penberg@cs.helsinki.fi> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
17e6e59f0a
commit
31d8519c9c
@@ -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;
|
newlen = newoff + t->len;
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (newlen >= ksize(ct->ext)) {
|
new = krealloc(ct->ext, newlen, gfp);
|
||||||
new = kmalloc(newlen, gfp);
|
if (!new)
|
||||||
if (!new)
|
return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
memcpy(new, ct->ext, ct->ext->len);
|
|
||||||
|
|
||||||
|
if (new != ct->ext) {
|
||||||
for (i = 0; i < NF_CT_EXT_NUM; i++) {
|
for (i = 0; i < NF_CT_EXT_NUM; i++) {
|
||||||
if (!nf_ct_ext_exist(ct, i))
|
if (!nf_ct_ext_exist(ct, i))
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user