Skip to content

Commit

Permalink
bpf: simplify code in btf_parse_hdr
Browse files Browse the repository at this point in the history
It could directly return 'btf_check_sec_info' to simplify code.

Signed-off-by: William Dean <williamsukatube@163.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20220917084248.3649-1-williamsukatube@163.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
  • Loading branch information
William Dean authored and Martin KaFai Lau committed Sep 21, 2022
1 parent 7620bff commit 3a74904
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions kernel/bpf/btf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4854,7 +4854,6 @@ static int btf_parse_hdr(struct btf_verifier_env *env)
u32 hdr_len, hdr_copy, btf_data_size;
const struct btf_header *hdr;
struct btf *btf;
int err;

btf = env->btf;
btf_data_size = btf->data_size;
Expand Down Expand Up @@ -4911,11 +4910,7 @@ static int btf_parse_hdr(struct btf_verifier_env *env)
return -EINVAL;
}

err = btf_check_sec_info(env, btf_data_size);
if (err)
return err;

return 0;
return btf_check_sec_info(env, btf_data_size);
}

static int btf_check_type_tags(struct btf_verifier_env *env,
Expand Down

0 comments on commit 3a74904

Please sign in to comment.