selftests/bpf: Properly initialize linfo in sockmap_basic
authorStanislav Fomichev <sdf@google.com>
Fri, 2 Oct 2020 00:04:51 +0000 (17:04 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 2 Oct 2020 14:47:32 +0000 (16:47 +0200)
When using -Werror=missing-braces, compiler complains about missing braces.
Let's use use ={} initialization which should do the job:

tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function 'test_sockmap_iter':
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: missing braces around initializer [-Werror=missing-braces]
  union bpf_iter_link_info linfo = {0};
        ^
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: (near initialization for 'linfo.map') [-Werror=missing-braces]
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: At top level:

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20201002000451.1794044-1-sdf@google.com
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c

index 4c4224e3e10a8657a34814c0c7aa3360d01e8068..85f73261fab0a91515c2bdaed6d1754292ed05ee 100644 (file)
@@ -198,7 +198,7 @@ static void test_sockmap_copy(enum bpf_map_type map_type)
 {
        DECLARE_LIBBPF_OPTS(bpf_iter_attach_opts, opts);
        int err, len, src_fd, iter_fd, duration = 0;
-       union bpf_iter_link_info linfo = {0};
+       union bpf_iter_link_info linfo = {};
        __u32 i, num_sockets, num_elems;
        struct bpf_iter_sockmap *skel;
        __s64 *sock_fd = NULL;