Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: arm64: Fix sparse warnings

ctx->image is declared as __le32 because arm64 instructions are LE
regardless of CPU's runtime endianness. emit_u32_data() emits raw data
and not instructions so cast the value to __le32 to fix the sparse
warning.

Cast function pointer to void * before doing arithmetic.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://lore.kernel.org/r/20251219191310.3204425-1-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Puranjay Mohan and committed by
Alexei Starovoitov
f785a313 d2749ae8

+2 -2
+2 -2
arch/arm64/net/bpf_jit_comp.c
··· 118 118 static inline void emit_u32_data(const u32 data, struct jit_ctx *ctx) 119 119 { 120 120 if (ctx->image != NULL && ctx->write) 121 - ctx->image[ctx->idx] = data; 121 + ctx->image[ctx->idx] = (__force __le32)data; 122 122 123 123 ctx->idx++; 124 124 } ··· 3139 3139 bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header); 3140 3140 kfree(jit_data); 3141 3141 } 3142 - prog->bpf_func -= cfi_get_offset(); 3142 + prog->bpf_func = (void *)prog->bpf_func - cfi_get_offset(); 3143 3143 hdr = bpf_jit_binary_pack_hdr(prog); 3144 3144 bpf_jit_binary_pack_free(hdr, NULL); 3145 3145 priv_stack_ptr = prog->aux->priv_stack_ptr;