Skip to content

Commit

Permalink
net: use the new API kvfree()
Browse files Browse the repository at this point in the history
It is available since v3.15-rc5.

Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
WANG Cong authored and David S. Miller committed Jun 5, 2014
1 parent 9638f67 commit 4cb2897
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 58 deletions.
10 changes: 2 additions & 8 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5933,10 +5933,7 @@ static void netdev_init_one_queue(struct net_device *dev,

static void netif_free_tx_queues(struct net_device *dev)
{
if (is_vmalloc_addr(dev->_tx))
vfree(dev->_tx);
else
kfree(dev->_tx);
kvfree(dev->_tx);
}

static int netif_alloc_netdev_queues(struct net_device *dev)
Expand Down Expand Up @@ -6410,10 +6407,7 @@ void netdev_freemem(struct net_device *dev)
{
char *addr = (char *)dev - dev->padded;

if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
kvfree(addr);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions net/ipv4/tcp_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,10 +1159,7 @@ static void __net_exit tcp_net_metrics_exit(struct net *net)
tm = next;
}
}
if (is_vmalloc_addr(net->ipv4.tcp_metrics_hash))
vfree(net->ipv4.tcp_metrics_hash);
else
kfree(net->ipv4.tcp_metrics_hash);
kvfree(net->ipv4.tcp_metrics_hash);
}

static __net_initdata struct pernet_operations tcp_net_metrics_ops = {
Expand Down
5 changes: 1 addition & 4 deletions net/netfilter/ipset/ip_set_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ ip_set_free(void *members)
{
pr_debug("%p: free with %s\n", members,
is_vmalloc_addr(members) ? "vfree" : "kfree");
if (is_vmalloc_addr(members))
vfree(members);
else
kfree(members);
kvfree(members);
}
EXPORT_SYMBOL_GPL(ip_set_free);

Expand Down
5 changes: 1 addition & 4 deletions net/netfilter/nft_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (is_vmalloc_addr(tbl))
vfree(tbl);
else
kfree(tbl);
kvfree(tbl);
}

static unsigned int nft_hash_tbl_size(unsigned int nelem)
Expand Down
5 changes: 1 addition & 4 deletions net/netfilter/xt_recent.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,7 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par)

static void recent_table_free(void *addr)
{
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
kvfree(addr);
}

static int recent_mt_check(const struct xt_mtchk_param *par,
Expand Down
7 changes: 1 addition & 6 deletions net/sched/sch_choke.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,7 @@ static const struct nla_policy choke_policy[TCA_CHOKE_MAX + 1] = {

static void choke_free(void *addr)
{
if (addr) {
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
kvfree(addr);
}

static int choke_change(struct Qdisc *sch, struct nlattr *opt)
Expand Down
5 changes: 1 addition & 4 deletions net/sched/sch_fq.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,7 @@ static void *fq_alloc_node(size_t sz, int node)

static void fq_free(void *addr)
{
if (addr && is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
kvfree(addr);
}

static int fq_resize(struct Qdisc *sch, u32 log)
Expand Down
7 changes: 1 addition & 6 deletions net/sched/sch_fq_codel.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,7 @@ static void *fq_codel_zalloc(size_t sz)

static void fq_codel_free(void *addr)
{
if (addr) {
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
kvfree(addr);
}

static void fq_codel_destroy(struct Qdisc *sch)
Expand Down
7 changes: 1 addition & 6 deletions net/sched/sch_hhf.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,7 @@ static void *hhf_zalloc(size_t sz)

static void hhf_free(void *addr)
{
if (addr) {
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
kvfree(addr);
}

static void hhf_destroy(struct Qdisc *sch)
Expand Down
7 changes: 1 addition & 6 deletions net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,7 @@ static void netem_reset(struct Qdisc *sch)

static void dist_free(struct disttable *d)
{
if (d) {
if (is_vmalloc_addr(d))
vfree(d);
else
kfree(d);
}
kvfree(d);
}

/*
Expand Down
7 changes: 1 addition & 6 deletions net/sched/sch_sfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,7 @@ static void *sfq_alloc(size_t sz)

static void sfq_free(void *addr)
{
if (addr) {
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
kvfree(addr);
}

static void sfq_destroy(struct Qdisc *sch)
Expand Down

0 comments on commit 4cb2897

Please sign in to comment.