On Tue, Sep 11, 2018 at 06:40:05PM +0200, Dmitry Vyukov wrote:
> Hi Martin,
> 
> I am looking at the subj commit:
> 
>  static int btf_add_type(struct btf_verifier_env *env, struct btf_type *t)
> @@ -1754,9 +1756,9 @@ static int btf_check_all_metas(struct
> btf_verifier_env *env)
>         struct btf_header *hdr;
>         void *cur, *end;
> 
> -       hdr = btf->hdr;
> +       hdr = &btf->hdr;
>         cur = btf->nohdr_data + hdr->type_off;
> -       end = btf->nohdr_data + hdr->str_off;
> +       end = btf->nohdr_data + hdr->type_len;
> 
> Shouldn't this be:
> 
> +       end = cur + hdr->type_len;
> 
> ? Or otherwise I am having trouble understanding meaning of fields.
You are correct.  Thanks for pointing this out.
Do you want to post an offical patch for the bpf branch?

> 
> On a related note, what's between header and type_off? Is type_off
> supposed to be 0 always?
type section is always the first section for now (i.e. immediately after
the header).  Some other sections could be introduced later and it could
be located before the type section such that the type_off will not be 0.

Reply via email to