summaryrefslogtreecommitdiffstats
path: root/security/min_addr.c
diff options
context:
space:
mode:
authorXu Kuohai <xukuohai@huawei.com>2022-08-08 00:07:35 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2022-08-10 16:50:57 +0200
commitaada476655461a9ab491d8298a415430cdd10278 (patch)
tree0dcd914c4efc99785d8471fbb189f5e639b1c970 /security/min_addr.c
parent46c8229c4317ba8576a206d285a34783390ba6ab (diff)
downloadlinux-stable-aada476655461a9ab491d8298a415430cdd10278.tar.gz
linux-stable-aada476655461a9ab491d8298a415430cdd10278.tar.bz2
linux-stable-aada476655461a9ab491d8298a415430cdd10278.zip
bpf, arm64: Fix bpf trampoline instruction endianness
The sparse tool complains as follows: arch/arm64/net/bpf_jit_comp.c:1684:16: warning: incorrect type in assignment (different base types) arch/arm64/net/bpf_jit_comp.c:1684:16: expected unsigned int [usertype] *branch arch/arm64/net/bpf_jit_comp.c:1684:16: got restricted __le32 [usertype] * arch/arm64/net/bpf_jit_comp.c:1700:52: error: subtraction of different types can't work (different base types) arch/arm64/net/bpf_jit_comp.c:1734:29: warning: incorrect type in assignment (different base types) arch/arm64/net/bpf_jit_comp.c:1734:29: expected unsigned int [usertype] * arch/arm64/net/bpf_jit_comp.c:1734:29: got restricted __le32 [usertype] * arch/arm64/net/bpf_jit_comp.c:1918:52: error: subtraction of different types can't work (different base types) This is because the variable branch in function invoke_bpf_prog and the variable branches in function prepare_trampoline are defined as type u32 *, which conflicts with ctx->image's type __le32 *, so sparse complains when assignment or arithmetic operation are performed on these two variables and ctx->image. Since arm64 instructions are always little-endian, change the type of these two variables to __le32 * and call cpu_to_le32() to convert instruction to little-endian before writing it to memory. This is also in line with emit() which internally does cpu_to_le32(), too. Fixes: efc9909fdce0 ("bpf, arm64: Add bpf trampoline for arm64") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Xu Kuohai <xukuohai@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Link: https://lore.kernel.org/bpf/20220808040735.1232002-1-xukuohai@huawei.com
Diffstat (limited to 'security/min_addr.c')
0 files changed, 0 insertions, 0 deletions