diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2023-10-06 20:57:42 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2023-10-06 21:17:28 +0300 |
commit | 925a01577ea5a70416731c00e42b74c97f41cb6a (patch) | |
tree | 39947655872d56199dd9a3d986b84b02aa0b38dc /tools/testing/selftests/bpf/map_tests | |
parent | bc5bc309db45a7ab218ce8259ba9bc7659be61ca (diff) | |
download | linux-925a01577ea5a70416731c00e42b74c97f41cb6a.tar.xz |
selftests/bpf: Fix compiler warnings reported in -O2 mode
Fix a bunch of potentially unitialized variable usage warnings that are
reported by GCC in -O2 mode. Also silence overzealous stringop-truncation
class of warnings.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20231006175744.3136675-1-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/map_tests')
-rw-r--r-- | tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c index 16f1671e4bde..66191ae9863c 100644 --- a/tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c @@ -33,11 +33,11 @@ static void create_inner_maps(enum bpf_map_type map_type, { int map_fd, map_index, ret; __u32 map_key = 0, map_id; - char map_name[15]; + char map_name[16]; for (map_index = 0; map_index < OUTER_MAP_ENTRIES; map_index++) { memset(map_name, 0, sizeof(map_name)); - sprintf(map_name, "inner_map_fd_%d", map_index); + snprintf(map_name, sizeof(map_name), "inner_map_fd_%d", map_index); map_fd = bpf_map_create(map_type, map_name, sizeof(__u32), sizeof(__u32), 1, NULL); CHECK(map_fd < 0, |