diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2007-02-10 04:45:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:27 -0500 |
commit | c376222960ae91d5ffb9197ee36771aaed1d9f90 (patch) | |
tree | 7f431c42529fec77433d33490bd9f2a8c47ba091 /net/ipv4 | |
parent | 1b135431abf5ea92e61bf4e91d93726c7b96da5f (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/ipv4')
-rw-r--r-- | net/ipv4/ipmr.c | 6 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_conn.c | 3 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_core.c | 3 |
3 files changed, 4 insertions, 8 deletions
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 | */ |
480 | static struct mfc_cache *ipmr_cache_alloc(void) | 480 | static 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 | ||
490 | static struct mfc_cache *ipmr_cache_alloc_unres(void) | 489 | static 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; |