]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/bpf/btf.c
Merge branch 'acpi-doc'
[linux.git] / kernel / bpf / btf.c
index b7c1660fb59449684d9cbf016444e2d625dff266..787140095e58d5d0882a50b32ad30d64dcb89a75 100644 (file)
@@ -3643,7 +3643,7 @@ struct btf *btf_parse_vmlinux(void)
                goto errout;
        }
 
-       bpf_struct_ops_init(btf);
+       bpf_struct_ops_init(btf, log);
 
        btf_verifier_env_free(env);
        refcount_set(&btf->refcnt, 1);
@@ -3931,6 +3931,7 @@ int btf_struct_access(struct bpf_verifier_log *log,
 
                if (btf_type_is_ptr(mtype)) {
                        const struct btf_type *stype;
+                       u32 id;
 
                        if (msize != size || off != moff) {
                                bpf_log(log,
@@ -3939,12 +3940,9 @@ int btf_struct_access(struct bpf_verifier_log *log,
                                return -EACCES;
                        }
 
-                       stype = btf_type_by_id(btf_vmlinux, mtype->type);
-                       /* skip modifiers */
-                       while (btf_type_is_modifier(stype))
-                               stype = btf_type_by_id(btf_vmlinux, stype->type);
+                       stype = btf_type_skip_modifiers(btf_vmlinux, mtype->type, &id);
                        if (btf_type_is_struct(stype)) {
-                               *next_btf_id = mtype->type;
+                               *next_btf_id = id;
                                return PTR_TO_BTF_ID;
                        }
                }
@@ -4144,9 +4142,9 @@ int btf_distill_func_proto(struct bpf_verifier_log *log,
  * EFAULT - verifier bug
  * 0 - 99% match. The last 1% is validated by the verifier.
  */
-int btf_check_func_type_match(struct bpf_verifier_log *log,
-                             struct btf *btf1, const struct btf_type *t1,
-                             struct btf *btf2, const struct btf_type *t2)
+static int btf_check_func_type_match(struct bpf_verifier_log *log,
+                                    struct btf *btf1, const struct btf_type *t1,
+                                    struct btf *btf2, const struct btf_type *t2)
 {
        const struct btf_param *args1, *args2;
        const char *fn1, *fn2, *s1, *s2;