[systemd-devel] [PATCH 5/6] network: fix strict aliasing issue

Lennart Poettering lennart at poettering.net
Mon Apr 13 01:18:02 PDT 2015


On Sun, 12.04.15 18:32, Shawn Landden (shawn at churchofgit.com) wrote:

> On Sun, Apr 12, 2015 at 12:43 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Wed, 11.03.15 08:13, Shawn Landden (shawn at churchofgit.com) wrote:
> >
> >> We shouldn't assume 64-bit arch with the way we do math either.
> >> (although I will submit a patch to glibc to add a uint64_t union
> >> alias)
> >
> > Hmm? uint64_t works fine on 32bit too. The compiler can do the
> > necessary emulation on its own... I don't see the need to change
> > anything here.
>
> Its also an unaligned access. in_addr.in6 is only 32-bit aligned. (in
> addition to being a strict aliasing violation.)

You are right. It is a possibly unaligned access.

Would be happy to take a patch that converts this to memcmp().

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list