summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/gen.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-02-11 22:09:27 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-02-15 20:58:34 +0300
commitd3b0b80064e0416850f818184b8f7bba9fdf8c40 (patch)
tree7d5af8c81563ba56e0bded28d08607731b17f57a /tools/bpf/bpftool/gen.c
parentedc21dc909c6c133a2727f063eadd7907af51f94 (diff)
downloadlinux-d3b0b80064e0416850f818184b8f7bba9fdf8c40.tar.xz
selftests/bpf: Fix GCC11 compiler warnings in -O2 mode
When compiling selftests in -O2 mode with GCC1, we get three new compilations warnings about potentially uninitialized variables. Compiler is wrong 2 out of 3 times, but this patch makes GCC11 happy anyways, as it doesn't cost us anything and makes optimized selftests build less annoying. The amazing one is tc_redirect case of token that is malloc()'ed before ASSERT_OK_PTR() check is done on it. Seems like GCC pessimistically assumes that libbpf_get_error() will dereference the contents of the pointer (no it won't), so the only way I found to shut GCC up was to do zero-initializaing calloc(). This one was new to me. For linfo case, GCC didn't realize that linfo_size will be initialized by the function that is returning linfo_size as out parameter. core_reloc.c case was a real bug, we can goto cleanup before initializing obj. But we don't need to do any clean up, so just continue iteration intstead. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220211190927.1434329-1-andrii@kernel.org
Diffstat (limited to 'tools/bpf/bpftool/gen.c')
0 files changed, 0 insertions, 0 deletions