提交 4cb28970 编写于 作者: W WANG Cong 提交者: David S. Miller

net: use the new API kvfree()

It is available since v3.15-rc5.

Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9638f671
...@@ -5933,10 +5933,7 @@ static void netdev_init_one_queue(struct net_device *dev, ...@@ -5933,10 +5933,7 @@ static void netdev_init_one_queue(struct net_device *dev,
static void netif_free_tx_queues(struct net_device *dev) static void netif_free_tx_queues(struct net_device *dev)
{ {
if (is_vmalloc_addr(dev->_tx)) kvfree(dev->_tx);
vfree(dev->_tx);
else
kfree(dev->_tx);
} }
static int netif_alloc_netdev_queues(struct net_device *dev) static int netif_alloc_netdev_queues(struct net_device *dev)
...@@ -6410,10 +6407,7 @@ void netdev_freemem(struct net_device *dev) ...@@ -6410,10 +6407,7 @@ void netdev_freemem(struct net_device *dev)
{ {
char *addr = (char *)dev - dev->padded; char *addr = (char *)dev - dev->padded;
if (is_vmalloc_addr(addr)) kvfree(addr);
vfree(addr);
else
kfree(addr);
} }
/** /**
......
...@@ -1159,10 +1159,7 @@ static void __net_exit tcp_net_metrics_exit(struct net *net) ...@@ -1159,10 +1159,7 @@ static void __net_exit tcp_net_metrics_exit(struct net *net)
tm = next; tm = next;
} }
} }
if (is_vmalloc_addr(net->ipv4.tcp_metrics_hash)) kvfree(net->ipv4.tcp_metrics_hash);
vfree(net->ipv4.tcp_metrics_hash);
else
kfree(net->ipv4.tcp_metrics_hash);
} }
static __net_initdata struct pernet_operations tcp_net_metrics_ops = { static __net_initdata struct pernet_operations tcp_net_metrics_ops = {
......
...@@ -271,10 +271,7 @@ ip_set_free(void *members) ...@@ -271,10 +271,7 @@ ip_set_free(void *members)
{ {
pr_debug("%p: free with %s\n", members, pr_debug("%p: free with %s\n", members,
is_vmalloc_addr(members) ? "vfree" : "kfree"); is_vmalloc_addr(members) ? "vfree" : "kfree");
if (is_vmalloc_addr(members)) kvfree(members);
vfree(members);
else
kfree(members);
} }
EXPORT_SYMBOL_GPL(ip_set_free); EXPORT_SYMBOL_GPL(ip_set_free);
......
...@@ -76,10 +76,7 @@ static bool nft_hash_lookup(const struct nft_set *set, ...@@ -76,10 +76,7 @@ static bool nft_hash_lookup(const struct nft_set *set,
static void nft_hash_tbl_free(const struct nft_hash_table *tbl) static void nft_hash_tbl_free(const struct nft_hash_table *tbl)
{ {
if (is_vmalloc_addr(tbl)) kvfree(tbl);
vfree(tbl);
else
kfree(tbl);
} }
static unsigned int nft_hash_tbl_size(unsigned int nelem) static unsigned int nft_hash_tbl_size(unsigned int nelem)
......
...@@ -313,10 +313,7 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par) ...@@ -313,10 +313,7 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par)
static void recent_table_free(void *addr) static void recent_table_free(void *addr)
{ {
if (is_vmalloc_addr(addr)) kvfree(addr);
vfree(addr);
else
kfree(addr);
} }
static int recent_mt_check(const struct xt_mtchk_param *par, static int recent_mt_check(const struct xt_mtchk_param *par,
......
...@@ -391,12 +391,7 @@ static const struct nla_policy choke_policy[TCA_CHOKE_MAX + 1] = { ...@@ -391,12 +391,7 @@ static const struct nla_policy choke_policy[TCA_CHOKE_MAX + 1] = {
static void choke_free(void *addr) static void choke_free(void *addr)
{ {
if (addr) { kvfree(addr);
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
} }
static int choke_change(struct Qdisc *sch, struct nlattr *opt) static int choke_change(struct Qdisc *sch, struct nlattr *opt)
......
...@@ -591,10 +591,7 @@ static void *fq_alloc_node(size_t sz, int node) ...@@ -591,10 +591,7 @@ static void *fq_alloc_node(size_t sz, int node)
static void fq_free(void *addr) static void fq_free(void *addr)
{ {
if (addr && is_vmalloc_addr(addr)) kvfree(addr);
vfree(addr);
else
kfree(addr);
} }
static int fq_resize(struct Qdisc *sch, u32 log) static int fq_resize(struct Qdisc *sch, u32 log)
......
...@@ -365,12 +365,7 @@ static void *fq_codel_zalloc(size_t sz) ...@@ -365,12 +365,7 @@ static void *fq_codel_zalloc(size_t sz)
static void fq_codel_free(void *addr) static void fq_codel_free(void *addr)
{ {
if (addr) { kvfree(addr);
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
} }
static void fq_codel_destroy(struct Qdisc *sch) static void fq_codel_destroy(struct Qdisc *sch)
......
...@@ -494,12 +494,7 @@ static void *hhf_zalloc(size_t sz) ...@@ -494,12 +494,7 @@ static void *hhf_zalloc(size_t sz)
static void hhf_free(void *addr) static void hhf_free(void *addr)
{ {
if (addr) { kvfree(addr);
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
} }
static void hhf_destroy(struct Qdisc *sch) static void hhf_destroy(struct Qdisc *sch)
......
...@@ -648,12 +648,7 @@ static void netem_reset(struct Qdisc *sch) ...@@ -648,12 +648,7 @@ static void netem_reset(struct Qdisc *sch)
static void dist_free(struct disttable *d) static void dist_free(struct disttable *d)
{ {
if (d) { kvfree(d);
if (is_vmalloc_addr(d))
vfree(d);
else
kfree(d);
}
} }
/* /*
......
...@@ -716,12 +716,7 @@ static void *sfq_alloc(size_t sz) ...@@ -716,12 +716,7 @@ static void *sfq_alloc(size_t sz)
static void sfq_free(void *addr) static void sfq_free(void *addr)
{ {
if (addr) { kvfree(addr);
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
} }
static void sfq_destroy(struct Qdisc *sch) static void sfq_destroy(struct Qdisc *sch)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册