All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	davem@davemloft.net, netdev@oss.sgi.com
Subject: Re: [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE
Date: Sat, 29 Jan 2005 01:21:28 +0100	[thread overview]
Message-ID: <20050129002128.GX31837@postel.suug.ch> (raw)
In-Reply-To: <20050128234828.GA24868@yakov.inr.ac.ru>

* Alexey Kuznetsov <20050128234828.GA24868@yakov.inr.ac.ru> 2005-01-29 02:48
> > > -#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
> 
> 
> ... which reminded me about an old stale patchlet:
> 
> 
> Comment: improper size calculation for collapsed skb size.
>          Noticed by Denis V. Lunev <den@asplinux.ru>
> 
> ===== net/ipv4/tcp_input.c 1.89 vs edited =====
> --- 1.89/net/ipv4/tcp_input.c	Tue Jan 18 01:09:33 2005
> +++ edited/net/ipv4/tcp_input.c	Thu Jan 27 19:41:07 2005
> @@ -3760,8 +3760,8 @@
>  	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 = (PAGE_SIZE - sizeof(struct skb_shared_info)
> +			    - header - 31)&~15;

Indeed, it can still exceed PAGE_SIZE in alloc_skb because of the SMP_CACHE_BYTES
alignment though. Can someone enlighten me about the magic 31 in there? I don't get
it from the context. The patch below should do a little bit better

--- 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)

  reply	other threads:[~2005-01-29  0:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28 23:03 [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE Thomas Graf
2005-01-28 23:22 ` Herbert Xu
2005-01-28 23:40   ` Thomas Graf
2005-02-07  6:27     ` David S. Miller
2005-01-28 23:48   ` Alexey Kuznetsov
2005-01-29  0:21     ` Thomas Graf [this message]
2005-01-29  0:27       ` Thomas Graf
2005-02-07  6:32         ` David S. Miller
2005-02-07 13:28           ` Thomas Graf
2005-02-07 14:27           ` [PATCH] NET: Fix calculation for collapsed skb size Thomas Graf
2005-02-09  4:54             ` David S. Miller
2005-01-29 18:40       ` [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE Alexey Kuznetsov
2005-01-29 12:47 ` Thomas Graf
2005-02-06 18:54 ` Thomas Graf
2005-02-06 21:08   ` David S. Miller
2005-02-07  6:25 ` David S. 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=20050129002128.GX31837@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.