summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_varlen.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2020-08-13 13:49:45 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-13 16:45:41 -0700
commit4fccd2ff74fbad222c69c7604307e0773a37ab8d (patch)
tree29871d1e9eaaf2461ebc6e47b21b2587a1e0e1ea /tools/testing/selftests/bpf/progs/test_varlen.c
parent0f993845d723c87656552837b412994d6086f086 (diff)
selftests/bpf: Make test_varlen work with 32-bit user-space arch
Despite bpftool generating data section memory layout that will work for 32-bit architectures on user-space side, BPF programs should be careful to not use ambiguous types like `long`, which have different size in 32-bit and 64-bit environments. Fix that in test by using __u64 explicitly, which is a recommended approach anyway. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200813204945.1020225-10-andriin@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_varlen.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_varlen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_varlen.c b/tools/testing/selftests/bpf/progs/test_varlen.c
index cd4b72c55dfe..913acdffd90f 100644
--- a/tools/testing/selftests/bpf/progs/test_varlen.c
+++ b/tools/testing/selftests/bpf/progs/test_varlen.c
@@ -15,9 +15,9 @@ int test_pid = 0;
bool capture = false;
/* .bss */
-long payload1_len1 = 0;
-long payload1_len2 = 0;
-long total1 = 0;
+__u64 payload1_len1 = 0;
+__u64 payload1_len2 = 0;
+__u64 total1 = 0;
char payload1[MAX_LEN + MAX_LEN] = {};
/* .data */