netdev
[Top] [All Lists]

Re: [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE

To: Thomas Graf <tgraf@xxxxxxx>
Subject: Re: [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Sun, 6 Feb 2005 22:32:39 -0800
Cc: kuznet@xxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050129002701.GY31837@xxxxxxxxxxxxxx>
References: <20050128230327.GV31837@xxxxxxxxxxxxxx> <E1CufRB-0000zf-00@xxxxxxxxxxxxxxxxxxxxxxxx> <20050128234828.GA24868@xxxxxxxxxxxxxxx> <20050129002128.GX31837@xxxxxxxxxxxxxx> <20050129002701.GY31837@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Sat, 29 Jan 2005 01:27:01 +0100
Thomas Graf <tgraf@xxxxxxx> wrote:

> * Thomas Graf <20050129002128.GX31837@xxxxxxxxxxxxxx> 2005-01-29 01:21
> > --- linux-2.6.11-rc2-bk4.orig/net/ipv4/tcp_input.c  2005-01-26 
> > 18:19:42.000000000 +0100
> > +++ linux-2.6.11-rc2-bk4/net/ipv4/tcp_input.c       2005-01-29 
> > 01:12:30.000000000 +0100
> > @@ -3760,8 +3760,7 @@
> >     while (before(start, end)) {
> >             struct sk_buff *nskb;
> >             int header = skb_headroom(skb);
> > -           int copy = (PAGE_SIZE - sizeof(struct sk_buff) -
> > -                       sizeof(struct skb_shared_info) - header - 31)&~15;
> > +           int copy = SKB_MAX_ORDER(header + 31, 0);
> >  
> >             /* Too big header? This can happen with IPv6. */
> >             if (copy < 0)
> 
> Sorry, this is incomplete, we should refetch copy via (skb->end - skb->head) 
> after
> allocating it.  I have to think some more about this first. ;-)

I don't understand, if we alloc_skb(copy) we are guarenteed to have
"copy" bytes available in the SKB data area.

This transformation to SKB_MAX_ORDER() (with the "+ 31" removed as
per Alexey's reply), seems perfectly fine to me.

Isn't it?

<Prev in Thread] Current Thread [Next in Thread>