summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-02-10 01:45:03 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 10:51:27 -0800
commitc376222960ae91d5ffb9197ee36771aaed1d9f90 (patch)
tree7f431c42529fec77433d33490bd9f2a8c47ba091 /net
parent1b135431abf5ea92e61bf4e91d93726c7b96da5f (diff)
[PATCH] Transform kmem_cache_alloc()+memset(0) -> kmem_cache_zalloc().
Replace appropriate pairs of "kmem_cache_alloc()" + "memset(0)" with the corresponding "kmem_cache_zalloc()" call. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Andi Kleen <ak@muc.de> Cc: Roland McGrath <roland@redhat.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Acked-by: Joel Becker <Joel.Becker@oracle.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Jan Kara <jack@ucw.cz> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/dst.c3
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/decnet/dn_table.c4
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c3
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c3
-rw-r--r--net/ipv6/ip6_fib.c3
-rw-r--r--net/sctp/sm_make_chunk.c3
8 files changed, 9 insertions, 20 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index 1a53fb39b7e..f9eace78d35 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -132,10 +132,9 @@ void * dst_alloc(struct dst_ops * ops)
if (ops->gc())
return NULL;
}
- dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC);
+ dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
if (!dst)
return NULL;
- memset(dst, 0, ops->entry_size);
atomic_set(&dst->__refcnt, 0);
dst->ops = ops;
dst->lastuse = jiffies;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 054d46493d2..efb673ad185 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -251,12 +251,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl)
goto out_entries;
}
- n = kmem_cache_alloc(tbl->kmem_cachep, GFP_ATOMIC);
+ n = kmem_cache_zalloc(tbl->kmem_cachep, GFP_ATOMIC);
if (!n)
goto out_entries;
- memset(n, 0, tbl->entry_size);
-
skb_queue_head_init(&n->arp_queue);
rwlock_init(&n->lock);
n->updated = n->used = now;
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index c1f0cc1b1c6..720501e1ae2 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -593,12 +593,10 @@ create:
replace:
err = -ENOBUFS;
- new_f = kmem_cache_alloc(dn_hash_kmem, GFP_KERNEL);
+ new_f = kmem_cache_zalloc(dn_hash_kmem, GFP_KERNEL);
if (new_f == NULL)
goto out;
- memset(new_f, 0, sizeof(struct dn_fib_node));
-
new_f->fn_key = key;
new_f->fn_type = type;
new_f->fn_scope = r->rtm_scope;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index ecb5422ea23..d7e1e60f51d 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -479,20 +479,18 @@ static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
*/
static struct mfc_cache *ipmr_cache_alloc(void)
{
- struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_KERNEL);
+ struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
if(c==NULL)
return NULL;
- memset(c, 0, sizeof(*c));
c->mfc_un.res.minvif = MAXVIFS;
return c;
}
static struct mfc_cache *ipmr_cache_alloc_unres(void)
{
- struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_ATOMIC);
+ struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
if(c==NULL)
return NULL;
- memset(c, 0, sizeof(*c));
skb_queue_head_init(&c->mfc_un.unres.unresolved);
c->mfc_un.unres.expires = jiffies + 10*HZ;
return c;
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index 8086787a2c5..3aec4ac66e3 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -603,13 +603,12 @@ ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport
struct ip_vs_conn *cp;
struct ip_vs_protocol *pp = ip_vs_proto_get(proto);
- cp = kmem_cache_alloc(ip_vs_conn_cachep, GFP_ATOMIC);
+ cp = kmem_cache_zalloc(ip_vs_conn_cachep, GFP_ATOMIC);
if (cp == NULL) {
IP_VS_ERR_RL("ip_vs_conn_new: no memory available.\n");
return NULL;
}
- memset(cp, 0, sizeof(*cp));
INIT_LIST_HEAD(&cp->c_list);
init_timer(&cp->timer);
cp->timer.data = (unsigned long)cp;
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 8556a4f4f60..62be2eb3769 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -638,14 +638,13 @@ struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *orig,
}
}
- conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC);
+ conntrack = kmem_cache_zalloc(ip_conntrack_cachep, GFP_ATOMIC);
if (!conntrack) {
DEBUGP("Can't allocate conntrack.\n");
atomic_dec(&ip_conntrack_count);
return ERR_PTR(-ENOMEM);
}
- memset(conntrack, 0, sizeof(*conntrack));
atomic_set(&conntrack->ct_general.use, 1);
conntrack->ct_general.destroy = destroy_conntrack;
conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 96d8310ae9c..827f8842b57 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -150,8 +150,7 @@ static __inline__ struct fib6_node * node_alloc(void)
{
struct fib6_node *fn;
- if ((fn = kmem_cache_alloc(fib6_node_kmem, GFP_ATOMIC)) != NULL)
- memset(fn, 0, sizeof(struct fib6_node));
+ fn = kmem_cache_zalloc(fib6_node_kmem, GFP_ATOMIC);
return fn;
}
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0b1ddb1005a..78348186017 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -979,11 +979,10 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
{
struct sctp_chunk *retval;
- retval = kmem_cache_alloc(sctp_chunk_cachep, GFP_ATOMIC);
+ retval = kmem_cache_zalloc(sctp_chunk_cachep, GFP_ATOMIC);
if (!retval)
goto nodata;
- memset(retval, 0, sizeof(struct sctp_chunk));
if (!sk) {
SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb);