Skip to content

Commit d30d42e

Browse files
iamkafaiAlexei Starovoitov
authored andcommitted
bpf: Change insn_offset to insn_off in bpf_func_info
The later patch will introduce "struct bpf_line_info" which has member "line_off" and "file_off" referring back to the string section in btf. The line_"off" and file_"off" are more consistent to the naming convention in btf.h that means "offset" (e.g. name_off in "struct btf_type"). The to-be-added "struct bpf_line_info" also has another member, "insn_off" which is the same as the "insn_offset" in "struct bpf_func_info". Hence, this patch renames "insn_offset" to "insn_off" for "struct bpf_func_info". Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 7337224 commit d30d42e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2991,7 +2991,7 @@ struct bpf_flow_keys {
29912991
};
29922992

29932993
struct bpf_func_info {
2994-
__u32 insn_offset;
2994+
__u32 insn_off;
29952995
__u32 type_id;
29962996
};
29972997

kernel/bpf/verifier.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4707,24 +4707,24 @@ static int check_btf_func(struct bpf_prog *prog, struct bpf_verifier_env *env,
47074707
goto free_btf;
47084708
}
47094709

4710-
/* check insn_offset */
4710+
/* check insn_off */
47114711
if (i == 0) {
4712-
if (krecord[i].insn_offset) {
4712+
if (krecord[i].insn_off) {
47134713
verbose(env,
4714-
"nonzero insn_offset %u for the first func info record",
4715-
krecord[i].insn_offset);
4714+
"nonzero insn_off %u for the first func info record",
4715+
krecord[i].insn_off);
47164716
ret = -EINVAL;
47174717
goto free_btf;
47184718
}
4719-
} else if (krecord[i].insn_offset <= prev_offset) {
4719+
} else if (krecord[i].insn_off <= prev_offset) {
47204720
verbose(env,
47214721
"same or smaller insn offset (%u) than previous func info record (%u)",
4722-
krecord[i].insn_offset, prev_offset);
4722+
krecord[i].insn_off, prev_offset);
47234723
ret = -EINVAL;
47244724
goto free_btf;
47254725
}
47264726

4727-
if (env->subprog_info[i].start != krecord[i].insn_offset) {
4727+
if (env->subprog_info[i].start != krecord[i].insn_off) {
47284728
verbose(env, "func_info BTF section doesn't match subprog layout in BPF program\n");
47294729
ret = -EINVAL;
47304730
goto free_btf;
@@ -4739,7 +4739,7 @@ static int check_btf_func(struct bpf_prog *prog, struct bpf_verifier_env *env,
47394739
goto free_btf;
47404740
}
47414741

4742-
prev_offset = krecord[i].insn_offset;
4742+
prev_offset = krecord[i].insn_off;
47434743
urecord += urec_size;
47444744
}
47454745

@@ -4762,7 +4762,7 @@ static void adjust_btf_func(struct bpf_verifier_env *env)
47624762
return;
47634763

47644764
for (i = 0; i < env->subprog_cnt; i++)
4765-
env->prog->aux->func_info[i].insn_offset = env->subprog_info[i].start;
4765+
env->prog->aux->func_info[i].insn_off = env->subprog_info[i].start;
47664766
}
47674767

47684768
/* check %cur's range satisfies %old's */

0 commit comments

Comments
 (0)