[PATCH] ctdb-common: Fix aliasing issue in IPv6 checksum (bug 13588)

Martin Schwenke martin at meltin.net
Thu Aug 23 03:25:24 UTC 2018

Since commit 9c51b278b1700cd5f3e2addc19b7c711cc2ea10b the compiler has
been able to inline the affected call to uint16_checksum().  Given
that the data (phdr) is being accessed by an incompatible
pointer (data) there is an aliasing problem when the call is inlined.
This results in incorrect behaviour with -O2/-O3 when compiling with
at least GCC 6, 7, and 8.

Fix this by making the types compatible.

Also fixes CID 1437604 (Reliance on integer endianness).  This is a
false positive because the uint16_checksum doesn't depend on the order
of the input uint16_t items.

Please review and maybe push...

peace & happiness,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ctdb-common-Fix-aliasing-issue-in-IPv6-checksum.patch
Type: text/x-patch
Size: 2012 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180823/abf15775/0001-ctdb-common-Fix-aliasing-issue-in-IPv6-checksum.bin>

More information about the samba-technical mailing list