]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: arm64: Silence "UBSAN: negation-overflow" warning
authorSong Liu <song@kernel.org>
Tue, 18 Feb 2025 08:02:40 +0000 (00:02 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:10 +0000 (11:13 +0200)
commit7ebd09a2154f2f5451c7b261826fb96dddb1f30a
tree747c1f494714b5f63572ddf93acc0a2ab7741fb4
parent27d618a9ec78463b90b70bfcb7dc5fb091c0e89d
bpf: arm64: Silence "UBSAN: negation-overflow" warning

[ Upstream commit 239860828f8660e2be487e2fbdae2640cce3fd67 ]

With UBSAN, test_bpf.ko triggers warnings like:

UBSAN: negation-overflow in arch/arm64/net/bpf_jit_comp.c:1333:28
negation of -2147483648 cannot be represented in type 's32' (aka 'int'):

Silence these warnings by casting imm to u32 first.

Reported-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Song Liu <song@kernel.org>
Tested-by: Breno Leitao <leitao@debian.org>
Link: https://lore.kernel.org/r/20250218080240.2431257-1-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/net/bpf_jit_comp.c