Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2002 00:51:56 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        Julian Elischer <julian@elischer.org>, Bosko Milekic <bmilekic@unixdaemons.com>, <freebsd-net@FreeBSD.ORG>
Subject:   Re: m_split() considered harmful
Message-ID:  <20020602004417.H2786-100000@gamplex.bde.org>
In-Reply-To: <200205312025.g4VKP9t02205@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 31 May 2002, Archie Cobbs wrote:

> That is, what we really need is a more general audit for code that
> writes into mbufs that might be read-only -- and, as one special case
> of tha, code that calls M_TRAILINGSPACE()/M_LEADINGSPACE() before writing
> into an mbuf.
>
> FYI, any easy way to do this would be to add const'ness to mtod():
>
>     #define mtod(m, t)  ((const t)((m)->m_data))
>
> and then look for GCC warnings. Any takers?? :-)

This assumes that t is literally a pointer.  When t is caddr_t,
`const t' is a const variable which (if caddr_t is `char *') is a
pointer to non-const storage, but you want a non-const pointer to
const storage.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020602004417.H2786-100000>