aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-02-10 04:45:03 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:27 -0500
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 1a53fb39b7e0..f9eace78d354 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -132,10 +132,9 @@ void * dst_alloc(struct dst_ops * ops)
132 if (ops->gc()) 132 if (ops->gc())
133 return NULL; 133 return NULL;
134 } 134 }
135 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); 135 dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
136 if (!dst) 136 if (!dst)
137 return NULL; 137 return NULL;
138 memset(dst, 0, ops->entry_size);
139 atomic_set(&dst->__refcnt, 0); 138 atomic_set(&dst->__refcnt, 0);
140 dst->ops = ops; 139 dst->ops = ops;
141 dst->lastuse = jiffies; 140 dst->lastuse = jiffies;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 054d46493d2b..efb673ad1854 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -251,12 +251,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl)
251 goto out_entries; 251 goto out_entries;
252 } 252 }
253 253
254 n = kmem_cache_alloc(tbl->kmem_cachep, GFP_ATOMIC); 254 n = kmem_cache_zalloc(tbl->kmem_cachep, GFP_ATOMIC);
255 if (!n) 255 if (!n)
256 goto out_entries; 256 goto out_entries;
257 257
258 memset(n, 0, tbl->entry_size);
259
260 skb_queue_head_init(&n->arp_queue); 258 skb_queue_head_init(&n->arp_queue);
261 rwlock_init(&n->lock); 259 rwlock_init(&n->lock);
262 n->updated = n->used = now; 260 n->updated = n->used = now;
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index c1f0cc1b1c60..720501e1ae20 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -593,12 +593,10 @@ create:
593 593
594replace: 594replace:
595 err = -ENOBUFS; 595 err = -ENOBUFS;
596 new_f = kmem_cache_alloc(dn_hash_kmem, GFP_KERNEL); 596 new_f = kmem_cache_zalloc(dn_hash_kmem, GFP_KERNEL);
597 if (new_f == NULL) 597 if (new_f == NULL)
598 goto out; 598 goto out;
599 599
600 memset(new_f, 0, sizeof(struct dn_fib_node));
601
602 new_f->fn_key = key; 600 new_f->fn_key = key;
603 new_f->fn_type = type; 601 new_f->fn_type = type;
604 new_f->fn_scope = r->rtm_scope; 602 new_f->fn_scope = r->rtm_scope;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index ecb5422ea237..d7e1e60f51d5 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)
479 */ 479 */
480static struct mfc_cache *ipmr_cache_alloc(void) 480static struct mfc_cache *ipmr_cache_alloc(void)
481{ 481{
482 struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_KERNEL); 482 struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
483 if(c==NULL) 483 if(c==NULL)
484 return NULL; 484 return NULL;
485 memset(c, 0, sizeof(*c));
486 c->mfc_un.res.minvif = MAXVIFS; 485 c->mfc_un.res.minvif = MAXVIFS;
487 return c; 486 return c;
488} 487}
489 488
490static struct mfc_cache *ipmr_cache_alloc_unres(void) 489static struct mfc_cache *ipmr_cache_alloc_unres(void)
491{ 490{
492 struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_ATOMIC); 491 struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
493 if(c==NULL) 492 if(c==NULL)
494 return NULL; 493 return NULL;
495 memset(c, 0, sizeof(*c));
496 skb_queue_head_init(&c->mfc_un.unres.unresolved); 494 skb_queue_head_init(&c->mfc_un.unres.unresolved);
497 c->mfc_un.unres.expires = jiffies + 10*HZ; 495 c->mfc_un.unres.expires = jiffies + 10*HZ;
498 return c; 496 return c;
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index 8086787a2c51..3aec4ac66e3c 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
603 struct ip_vs_conn *cp; 603 struct ip_vs_conn *cp;
604 struct ip_vs_protocol *pp = ip_vs_proto_get(proto); 604 struct ip_vs_protocol *pp = ip_vs_proto_get(proto);
605 605
606 cp = kmem_cache_alloc(ip_vs_conn_cachep, GFP_ATOMIC); 606 cp = kmem_cache_zalloc(ip_vs_conn_cachep, GFP_ATOMIC);
607 if (cp == NULL) { 607 if (cp == NULL) {
608 IP_VS_ERR_RL("ip_vs_conn_new: no memory available.\n"); 608 IP_VS_ERR_RL("ip_vs_conn_new: no memory available.\n");
609 return NULL; 609 return NULL;
610 } 610 }
611 611
612 memset(cp, 0, sizeof(*cp));
613 INIT_LIST_HEAD(&cp->c_list); 612 INIT_LIST_HEAD(&cp->c_list);
614 init_timer(&cp->timer); 613 init_timer(&cp->timer);
615 cp->timer.data = (unsigned long)cp; 614 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 8556a4f4f60a..62be2eb37698 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,
638 } 638 }
639 } 639 }
640 640
641 conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC); 641 conntrack = kmem_cache_zalloc(ip_conntrack_cachep, GFP_ATOMIC);
642 if (!conntrack) { 642 if (!conntrack) {
643 DEBUGP("Can't allocate conntrack.\n"); 643 DEBUGP("Can't allocate conntrack.\n");
644 atomic_dec(&ip_conntrack_count); 644 atomic_dec(&ip_conntrack_count);
645 return ERR_PTR(-ENOMEM); 645 return ERR_PTR(-ENOMEM);
646 } 646 }
647 647
648 memset(conntrack, 0, sizeof(*conntrack));
649 atomic_set(&conntrack->ct_general.use, 1); 648 atomic_set(&conntrack->ct_general.use, 1);
650 conntrack->ct_general.destroy = destroy_conntrack; 649 conntrack->ct_general.destroy = destroy_conntrack;
651 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig; 650 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 96d8310ae9c8..827f8842b578 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)
150{ 150{
151 struct fib6_node *fn; 151 struct fib6_node *fn;
152 152
153 if ((fn = kmem_cache_alloc(fib6_node_kmem, GFP_ATOMIC)) != NULL) 153 fn = kmem_cache_zalloc(fib6_node_kmem, GFP_ATOMIC);
154 memset(fn, 0, sizeof(struct fib6_node));
155 154
156 return fn; 155 return fn;
157} 156}
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0b1ddb1005ac..783481860174 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,
979{ 979{
980 struct sctp_chunk *retval; 980 struct sctp_chunk *retval;
981 981
982 retval = kmem_cache_alloc(sctp_chunk_cachep, GFP_ATOMIC); 982 retval = kmem_cache_zalloc(sctp_chunk_cachep, GFP_ATOMIC);
983 983
984 if (!retval) 984 if (!retval)
985 goto nodata; 985 goto nodata;
986 memset(retval, 0, sizeof(struct sctp_chunk));
987 986
988 if (!sk) { 987 if (!sk) {
989 SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb); 988 SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb);