From: Andrii Nakryiko Date: Wed, 24 Nov 2021 00:23:19 +0000 (-0800) Subject: selftests/bpf: Fix UBSan complaint about signed __int128 overflow X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=486e648cb2f170702fc05f777c7b6b3d8ec662ce;p=linux.git selftests/bpf: Fix UBSan complaint about signed __int128 overflow Test is using __int128 variable as unsigned and highest order bit can be set to 1 after bit shift. Use unsigned __int128 explicitly and prevent UBSan from complaining. Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20211124002325.1737739-8-andrii@kernel.org --- diff --git a/tools/testing/selftests/bpf/prog_tests/btf_dump.c b/tools/testing/selftests/bpf/prog_tests/btf_dump.c index af47aeb211e7d..9e26903f9170c 100644 --- a/tools/testing/selftests/bpf/prog_tests/btf_dump.c +++ b/tools/testing/selftests/bpf/prog_tests/btf_dump.c @@ -323,7 +323,7 @@ static void test_btf_dump_int_data(struct btf *btf, struct btf_dump *d, char *str) { #ifdef __SIZEOF_INT128__ - __int128 i = 0xffffffffffffffff; + unsigned __int128 i = 0xffffffffffffffff; /* this dance is required because we cannot directly initialize * a 128-bit value to anything larger than a 64-bit value.