Skip to content

Commit

Permalink
ipv4: Initialize on-stack cork more efficiently.
Browse files Browse the repository at this point in the history
ip_setup_cork() explicitly initializes every member of
inet_cork except flags, addr, and opt.  So we can simply
set those three members to zero instead of using a
memset() via an empty struct assignment.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
  • Loading branch information
David S. Miller committed May 6, 2011
1 parent bdc712b commit b80d722
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ struct sk_buff *ip_make_skb(struct sock *sk,
struct ipcm_cookie *ipc, struct rtable **rtp,
unsigned int flags)
{
struct inet_cork cork = {};
struct inet_cork cork;
struct sk_buff_head queue;
int err;

Expand All @@ -1417,6 +1417,9 @@ struct sk_buff *ip_make_skb(struct sock *sk,

__skb_queue_head_init(&queue);

cork.flags = 0;
cork.addr = 0;
cork.opt = 0;
err = ip_setup_cork(sk, &cork, ipc, rtp);
if (err)
return ERR_PTR(err);
Expand Down

0 comments on commit b80d722

Please sign in to comment.