From: "Denis V. Lunev" <den@openvz•org>
To: davem@davemloft•net
Cc: den@openvz•org, netdev@vger•kernel.org
Subject: [PATCH] kmalloc+memset -> kzalloc in frag_alloc_queue
Date: Mon, 15 Oct 2007 18:48:41 +0400 [thread overview]
Message-ID: <20071015144841.GA1009@iris.sw.ru> (raw)
kmalloc + memset -> kzalloc in frag_alloc_queue
Signed-off-by: Denis V. Lunev <den@openvz•org>
--- ./net/ipv4/ip_fragment.c.alloc 2007-10-15 13:55:25.000000000 +0400
+++ ./net/ipv4/ip_fragment.c 2007-10-15 17:47:41.000000000 +0400
@@ -144,7 +144,7 @@ static __inline__ void ip4_frag_free(str
static __inline__ struct ipq *frag_alloc_queue(void)
{
- struct ipq *qp = kmalloc(sizeof(struct ipq), GFP_ATOMIC);
+ struct ipq *qp = kzalloc(sizeof(struct ipq), GFP_ATOMIC);
if (!qp)
return NULL;
@@ -265,15 +265,10 @@ static struct ipq *ip_frag_create(struct
goto out_nomem;
qp->protocol = iph->protocol;
- qp->q.last_in = 0;
qp->id = iph->id;
qp->saddr = iph->saddr;
qp->daddr = iph->daddr;
qp->user = user;
- qp->q.len = 0;
- qp->q.meat = 0;
- qp->q.fragments = NULL;
- qp->iif = 0;
qp->peer = sysctl_ipfrag_max_dist ? inet_getpeer(iph->saddr, 1) : NULL;
/* Initialize a timer for this entry. */
--- ./net/ipv6/netfilter/nf_conntrack_reasm.c.alloc 2007-10-15 13:55:25.000000000 +0400
+++ ./net/ipv6/netfilter/nf_conntrack_reasm.c 2007-10-15 17:47:29.000000000 +0400
@@ -137,9 +137,10 @@ static void nf_frag_free(struct inet_fra
static inline struct nf_ct_frag6_queue *frag_alloc_queue(void)
{
- struct nf_ct_frag6_queue *fq = kmalloc(sizeof(struct nf_ct_frag6_queue), GFP_ATOMIC);
+ struct nf_ct_frag6_queue *fq;
- if (!fq)
+ fq = kzalloc(sizeof(struct nf_ct_frag6_queue), GFP_ATOMIC);
+ if (fq == NULL)
return NULL;
atomic_add(sizeof(struct nf_ct_frag6_queue), &nf_frags.mem);
return fq;
@@ -230,8 +231,6 @@ nf_ct_frag6_create(unsigned int hash, __
goto oom;
}
- memset(fq, 0, sizeof(struct nf_ct_frag6_queue));
-
fq->id = id;
ipv6_addr_copy(&fq->saddr, src);
ipv6_addr_copy(&fq->daddr, dst);
next reply other threads:[~2007-10-15 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 14:48 Denis V. Lunev [this message]
2007-10-15 19:53 ` [PATCH] kmalloc+memset -> kzalloc in frag_alloc_queue David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071015144841.GA1009@iris.sw.ru \
--to=den@openvz$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox