From owner-cvs-src@FreeBSD.ORG Sat Nov 15 18:07:56 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEEFF16A4CE; Sat, 15 Nov 2003 18:07:56 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAC3243F3F; Sat, 15 Nov 2003 18:07:54 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id NAA16888; Sun, 16 Nov 2003 13:07:49 +1100 Date: Sun, 16 Nov 2003 13:07:48 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20031115121034.K54473@root.org> Message-ID: <20031116125743.O3188@gamplex.bde.org> References: <20031115170411.6330416A4E9@hub.freebsd.org> <20031115121034.K54473@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: Andre Oppermann cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/netinet ip_fastfwd.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2003 02:07:56 -0000 On Sat, 15 Nov 2003, Nate Lawson wrote: > On Sat, 15 Nov 2003, Andre Oppermann wrote: > > --- src/sys/netinet/ip_fastfwd.c:1.1 Fri Nov 14 13:02:21 2003 > > +++ src/sys/netinet/ip_fastfwd.c Sat Nov 15 09:03:37 2003 > > @@ -567,7 +567,7 @@ > > goto drop; > > } > > tag->m_flags = PACKET_TAG_DIVERT; > > - tag->m_data = (caddr_t)(u_int32_t)args.divert_rule; > > + tag->m_data = (caddr_t)(u_long)args.divert_rule; > > tag->m_next = m; > > /* XXX: really bloody hack, see ip_input */ > > tag->m_nextpkt = (struct mbuf *)1; > > I believe this cast is still bogus. You want uintptr_t. Actually intptr_t. The code that converts the value back to an int uses intptr_t, and mixing uintptr_t with intptr_t gives an implementation-defined total conversion which is not necessarily the identity. After fixing this, the other half of the cast would be still be bogus. intptr_t and uintptr_t only have defined behaviour for conversions to and from void *, but caddr_t is supposed to be an opaque type. caddr_t happens to be char *, so it is equivalent to void * in most contexts including probably this one, but but it takes much more familiarity with C to know this than to know what [u]intptr_t does. Using caddr_t is bogus for other reasons; it should never be used, but it is still used for the type of m_data, so the above code has to be aware of it. Bruce