提交 486e648c 编写于 作者: A Andrii Nakryiko 提交者: Daniel Borkmann

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: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211124002325.1737739-8-andrii@kernel.org
上级 59383537
...@@ -323,7 +323,7 @@ static void test_btf_dump_int_data(struct btf *btf, struct btf_dump *d, ...@@ -323,7 +323,7 @@ static void test_btf_dump_int_data(struct btf *btf, struct btf_dump *d,
char *str) char *str)
{ {
#ifdef __SIZEOF_INT128__ #ifdef __SIZEOF_INT128__
__int128 i = 0xffffffffffffffff; unsigned __int128 i = 0xffffffffffffffff;
/* this dance is required because we cannot directly initialize /* this dance is required because we cannot directly initialize
* a 128-bit value to anything larger than a 64-bit value. * a 128-bit value to anything larger than a 64-bit value.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册