netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: Joe Perches <joe@perches.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next] icmp: avoid allocating large struct on stack
Date: Sat, 01 Jun 2013 11:42:46 +0800	[thread overview]
Message-ID: <1370058166.4723.1.camel@cr0> (raw)
In-Reply-To: <1370057669.10556.104.camel@joe-AO722>

On Fri, 2013-05-31 at 20:34 -0700, Joe Perches wrote:
> On Sat, 2013-06-01 at 11:24 +0800, Cong Wang wrote:
> > struct icmp_bxm is a large struct, reduce stack usage
> > by allocating it on heap.
> []
> > diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> []
> > @@ -558,6 +558,10 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
> >  		}
> >  	}
> >  
> > +	icmp_param = kzalloc(sizeof(*icmp_param), GFP_ATOMIC);
> 
> why kzalloc if the previous stack was uninitialized?
> 
> 

Right, kmalloc() should be sufficient here...

  reply	other threads:[~2013-06-01  3:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01  3:24 [Patch net-next] icmp: avoid allocating large struct on stack Cong Wang
2013-06-01  3:34 ` Joe Perches
2013-06-01  3:42   ` Cong Wang [this message]
2013-06-01  5:22 ` Eric Dumazet
2013-06-02  1:14   ` Cong Wang

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=1370058166.4723.1.camel@cr0 \
    --to=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).