Skip to content

Commit acbd8ef

Browse files
arndbkernel-patches-bot
authored andcommitted
bpf: suppress -Wcast-function-type warning
Building with -Wextra shows lots of warnings in the bpf code such as kernel/bpf/verifier.c: In function ‘jit_subprogs’: include/linux/filter.h:345:4: warning: cast between incompatible function types from ‘unsigned int (*)(const void *, const struct bpf_insn *)’ to ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} [-Wcast-function-type] 345 | ((u64 (*)(u64, u64, u64, u64, u64))(x)) | ^ kernel/bpf/verifier.c:10706:16: note: in expansion of macro ‘BPF_CAST_CALL’ 10706 | insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) - | ^~~~~~~~~~~~~ This appears to be intentional, so change the cast in a way that suppresses the warning. Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
1 parent 2041f65 commit acbd8ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn)
342342
/* Function call */
343343

344344
#define BPF_CAST_CALL(x) \
345-
((u64 (*)(u64, u64, u64, u64, u64))(x))
345+
((u64 (*)(u64, u64, u64, u64, u64))(uintptr_t)(x))
346346

347347
#define BPF_EMIT_CALL(FUNC) \
348348
((struct bpf_insn) { \

0 commit comments

Comments
 (0)