diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-03-13 13:09:19 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-03-16 12:26:49 -0700 |
commit | 105b842ba4ef2ddc287645cb33f90b960c16075b (patch) | |
tree | aef07129a6876cee43548b03b211c1224f808e3a /tools/testing/selftests/bpf/Makefile | |
parent | bpftool: Fix maybe-uninitialized warnings (diff) | |
download | linux-dev-105b842ba4ef2ddc287645cb33f90b960c16075b.tar.xz linux-dev-105b842ba4ef2ddc287645cb33f90b960c16075b.zip |
selftests/bpf: Fix maybe-uninitialized warning in xdpxceiver test
xsk_ring_prod__reserve() doesn't necessarily set idx in some conditions, so
from static analysis point of view compiler is right about the problems like:
In file included from xdpxceiver.c:92:
xdpxceiver.c: In function ‘xsk_populate_fill_ring’:
/data/users/andriin/linux/tools/testing/selftests/bpf/tools/include/bpf/xsk.h:119:20: warning: ‘idx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return &addrs[idx & fill->mask];
~~~~^~~~~~~~~~~~
xdpxceiver.c:300:6: note: ‘idx’ was declared here
u32 idx;
^~~
xdpxceiver.c: In function ‘tx_only’:
xdpxceiver.c:596:30: warning: ‘idx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
struct xdp_desc *tx_desc = xsk_ring_prod__tx_desc(&xsk->tx, idx + i);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix two warnings reported by compiler by pre-initializing variable.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210313210920.1959628-4-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/Makefile')
0 files changed, 0 insertions, 0 deletions