Re: [PATCH bpf-next] selftests/bpf: fix -Wstrict-aliasing in test_sockopt_sk.c

2019-06-28 Thread Daniel Borkmann
On 06/28/2019 03:12 AM, Stanislav Fomichev wrote: > Let's use union with u8[4] and u32 members for sockopt buffer, > that should fix any possible aliasing issues. > > test_sockopt_sk.c: In function ‘getsetsockopt’: > test_sockopt_sk.c:115:2: warning: dereferencing type-punned pointer will > break

Re: [PATCH bpf-next] selftests/bpf: fix -Wstrict-aliasing in test_sockopt_sk.c

2019-06-28 Thread Song Liu
On Thu, Jun 27, 2019 at 6:14 PM Stanislav Fomichev wrote: > > Let's use union with u8[4] and u32 members for sockopt buffer, > that should fix any possible aliasing issues. > > test_sockopt_sk.c: In function ‘getsetsockopt’: > test_sockopt_sk.c:115:2: warning: dereferencing type-punned pointer wil

[PATCH bpf-next] selftests/bpf: fix -Wstrict-aliasing in test_sockopt_sk.c

2019-06-27 Thread Stanislav Fomichev
Let's use union with u8[4] and u32 members for sockopt buffer, that should fix any possible aliasing issues. test_sockopt_sk.c: In function ‘getsetsockopt’: test_sockopt_sk.c:115:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] if (*(__u32 *)buf