bpf: generalize is_branch_taken to handle all conditional jumps in one place
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 2 Nov 2023 03:37:56 +0000 (20:37 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 10 Nov 2023 02:58:40 +0000 (18:58 -0800)
commitb74c2a842bba941945279027083fcee1e9aaa73f
treeb74a08de9ced5f5a686a7cbf080296652d03421b
parentc697289efe4ef38bc5c62f119cb74433f784b826
bpf: generalize is_branch_taken to handle all conditional jumps in one place

Make is_branch_taken() a single entry point for branch pruning decision
making, handling both pointer vs pointer, pointer vs scalar, and scalar
vs scalar cases in one place. This also nicely cleans up check_cond_jmp_op().

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231102033759.2541186-15-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c