From: Kui-Feng Lee Date: Thu, 23 May 2024 17:41:54 +0000 (-0700) Subject: bpf: Remove unnecessary checks on the offset of btf_field. X-Git-Tag: v6.11-rc1~163^2~222^2~15^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c95a3be45ad22ee8925d6d1ab531d5ba98216311;p=thirdparty%2Flinux.git bpf: Remove unnecessary checks on the offset of btf_field. reg_find_field_offset() always return a btf_field with a matching offset value. Checking the offset of the returned btf_field is unnecessary. Acked-by: Eduard Zingerman Signed-off-by: Kui-Feng Lee Link: https://lore.kernel.org/r/20240523174202.461236-2-thinker.li@gmail.com Signed-off-by: Alexei Starovoitov --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 77da1f438becc..57c0c255bf4c6 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -11640,7 +11640,7 @@ __process_kf_arg_ptr_to_graph_node(struct bpf_verifier_env *env, node_off = reg->off + reg->var_off.value; field = reg_find_field_offset(reg, node_off, node_field_type); - if (!field || field->offset != node_off) { + if (!field) { verbose(env, "%s not found at offset=%u\n", node_type_name, node_off); return -EINVAL; }