[SLOF] [PATCH] ipv6: Fix gcc9 warnings

Thomas Huth thuth at redhat.com
Wed Oct 16 22:54:08 AEDT 2019

On 30/09/2019 09.43, Thomas Huth wrote:
> GCC 9 introduced some new compiler warnings that occur when taking the
> address of a packed struct, e.g.:
>  lib/libnet/icmpv6.c:173:21: warning: taking address of packed member of
>  ‘struct ip6hdr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
>   173 |  rtr = find_router (&(ip6h->src));
>       |                     ^~~~~~~~~~~~
> Since these warnings are mainly about the ip6_addr_t values that are
> embedded in these packed structs, and ip6_addr_t is reasonable small
> (just 128 bit), let's fix it by passing around the IPv6 addresses by
> value instead of pointer, which looks a little bit nicer anyway.
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> [thuth: Fixed more spots, adjusted the coding style, added patch description]
> Signed-off-by: Thomas Huth <thuth at redhat.com>
> ---
>  Alexey, can you additionally commit your "ipv6: Fix more gcc9 warnings"
>  patch? ... with both patches applied, the libnet code is then finally
>  free from compiler warnings for me.



More information about the SLOF mailing list