bpf: Fix bpf_throw warning on 32-bit arch
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 18 Sep 2023 15:52:32 +0000 (17:52 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 19 Sep 2023 09:07:36 +0000 (02:07 -0700)
commit7d3460632da2c2ad5c5708db82a0b72e2b66396c
tree87dbc485165e8027a57e2c028266a28536789266
parent4d84dcc739d5b253096f9e47957c5964709f5772
bpf: Fix bpf_throw warning on 32-bit arch

On 32-bit architectures, the pointer width is 32-bit, while we try to
cast from a u64 down to it, the compiler complains on mismatch in
integer size. Fix this by first casting to long which should match
the pointer width on targets supported by Linux.

Fixes: ec5290a178b7 ("bpf: Prevent KASAN false positive with bpf_throw")
Reported-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Tested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/20230918155233.297024-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c