Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2007 17:57:32 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        danfe@freebsd.org, src-committers@freebsd.org, cvs-src@freebsd.org, cvs-all@freebsd.org, jb@freebsd.org, des@des.no, max@love2party.net
Subject:   Re: cvs commit: src/sys/netinet/libalias alias_util.c
Message-ID:  <200712051757.33843.jhb@freebsd.org>
In-Reply-To: <20071204.140821.-772295776.imp@bsdimp.com>
References:  <200712031657.34074.jhb@freebsd.org> <200712041928.36391.max@love2party.net> <20071204.140821.-772295776.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 04 December 2007 04:08:21 pm M. Warner Losh wrote:
> In message: <200712041928.36391.max@love2party.net>
>             Max Laier <max@love2party.net> writes:
> : On Tuesday 04 December 2007, Alexey Dokuchaev wrote:
> : > On Mon, Dec 03, 2007 at 04:57:33PM -0500, John Baldwin wrote:
> : > > On Monday 03 December 2007 10:24:52 am Dag-Erling Sm??rgrav wrote:
> : > > > John Birrell <jb@FreeBSD.org> writes:
> : > > > >   Log:
> : > > > >   Fix strict alias warnings.
> : > > >
> : > > > A much simpler solution (relative to the previous revision):
> : > > >
> : > > > @@ -131,10 +131,10 @@
> : > > >                 sum += oddbyte;
> : > > >         }
> : > > >  /* "Pseudo-header" data */
> : > > > -       ptr = (u_short *) & (pip->ip_dst);
> : > > > +       ptr = (void *)&pip->ip_dst;
> : > > >         sum += *ptr++;
> : > > >         sum += *ptr;
> : > > > -       ptr = (u_short *) & (pip->ip_src);
> : > > > +       ptr = (void *)&pip->ip_src;
> : > > >         sum += *ptr++;
> : > > >         sum += *ptr;
> : > > >         sum += htons((u_short) ntcp);
> : > >
> : > > *ptr++ would choke since pointer arith on (void *) is undefined
> : > > AFAIK.
> : >
> : > I've been under impression that ++ on void * whould simply increase it
> : > by one.
> : 
> : wasn't that the reason why caddr_t exists?  i.e. pointer arithmetic on 
> : void * is bad, but on caddr_t it's kinda okay.
> 
> Let's go look at the original code:
> 
>         u_short *ptr;
> 
> and restate your objections...

Bah, brain-o on my part, sorry.

-- 
John Baldwin



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