Skip to content

Commit 9b2c9d6

Browse files
ytcoodeNobody
authored andcommitted
bpf: Use offsetofend() to simplify macro definition
Use offsetofend() instead of offsetof() + sizeof() to simplify MIN_BPF_LINEINFO_SIZE macro definition. Signed-off-by: Yuntao Wang <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: Joanne Koong <[email protected]>
1 parent 439196f commit 9b2c9d6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/bpf/verifier.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10400,8 +10400,7 @@ static void adjust_btf_func(struct bpf_verifier_env *env)
1040010400
aux->func_info[i].insn_off = env->subprog_info[i].start;
1040110401
}
1040210402

10403-
#define MIN_BPF_LINEINFO_SIZE (offsetof(struct bpf_line_info, line_col) + \
10404-
sizeof(((struct bpf_line_info *)(0))->line_col))
10403+
#define MIN_BPF_LINEINFO_SIZE offsetofend(struct bpf_line_info, line_col)
1040510404
#define MAX_LINEINFO_REC_SIZE MAX_FUNCINFO_REC_SIZE
1040610405

1040710406
static int check_btf_line(struct bpf_verifier_env *env,

0 commit comments

Comments
 (0)