]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bpf: Remove unnecessary checks on the offset of btf_field.
authorKui-Feng Lee <thinker.li@gmail.com>
Thu, 23 May 2024 17:41:54 +0000 (10:41 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 4 Jun 2024 03:52:42 +0000 (20:52 -0700)
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 <eddyz87@gmail.com>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Link: https://lore.kernel.org/r/20240523174202.461236-2-thinker.li@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index 77da1f438beccec71f59a4b129323a1064389e12..57c0c255bf4c6148c3cb0ad4549a434ffcff1b95 100644 (file)
@@ -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;
        }