bpf: Use offsetofend() to simplify macro definition
authorYuntao Wang <ytcoode@gmail.com>
Thu, 10 Mar 2022 16:15:18 +0000 (00:15 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 10 Mar 2022 22:04:47 +0000 (23:04 +0100)
Use offsetofend() instead of offsetof() + sizeof() to simplify
MIN_BPF_LINEINFO_SIZE macro definition.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Joanne Koong <joannelkoong@gmail.com>
Link: https://lore.kernel.org/bpf/20220310161518.534544-1-ytcoode@gmail.com
kernel/bpf/verifier.c

index e34264200e0985ad1afed919e531e0c608d3197f..0db6cd8dcb3599d1ea7da5058dd947d62df4ec56 100644 (file)
@@ -10400,8 +10400,7 @@ static void adjust_btf_func(struct bpf_verifier_env *env)
                aux->func_info[i].insn_off = env->subprog_info[i].start;
 }
 
-#define MIN_BPF_LINEINFO_SIZE  (offsetof(struct bpf_line_info, line_col) + \
-               sizeof(((struct bpf_line_info *)(0))->line_col))
+#define MIN_BPF_LINEINFO_SIZE  offsetofend(struct bpf_line_info, line_col)
 #define MAX_LINEINFO_REC_SIZE  MAX_FUNCINFO_REC_SIZE
 
 static int check_btf_line(struct bpf_verifier_env *env,