netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: [patch] clean up tcp_sk(), 2.6.0
Date: Tue, 30 Dec 2003 17:32:30 +0100	[thread overview]
Message-ID: <20031230163230.GA12553@elte.hu> (raw)


i recently wasted a few hours on a bug where i used "tcp_sk(sock)"
instead of "tcp_sk(sock->sk)" - the former, while being blatantly
incorrect, compiles just fine on 2.6.0. The patch below is equivalent to
the define but is also type-safe. Compiles cleanly & boots fine on
2.6.0.

	Ingo

--- linux/include/linux/tcp.h.orig
+++ linux/include/linux/tcp.h
@@ -386,7 +386,10 @@ struct tcp_sock {
 	struct tcp_opt	  tcp;
 };
 
-#define tcp_sk(__sk) (&((struct tcp_sock *)__sk)->tcp)
+static inline struct tcp_opt * tcp_sk(const struct sock *__sk)
+{
+	return &((struct tcp_sock *)__sk)->tcp;
+}
 
 #endif
 

             reply	other threads:[~2003-12-30 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-30 16:32 Ingo Molnar [this message]
2003-12-30 16:50 ` [patch] clean up tcp_sk(), 2.6.0 YOSHIFUJI Hideaki / 吉藤英明
2003-12-30 16:57 ` Arnaldo Carvalho de Melo
2003-12-30 22:46 ` David S. Miller
2003-12-31 10:12   ` Ingo Molnar

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=20031230163230.GA12553@elte.hu \
    --to=mingo@elte.hu \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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).